Using the Cmdline Switch causes Saved/Config/ini files to not be found

Dear Friends at Epic (and Josh),

As per Josh’s response in this thread:
https://rocket.unrealengine.com/questions/16734/getting-my-documents-or-appdata-path.html

I added this to my commandline:

-SaveToUserDir

#Loading Data From Config

I have been saving and loading data from config files, particularly game.ini, which are stored in:

GameDir/Saved/Windows/Config

my code below no longer works, the config file is not found, when I use -SaveToUserDir

if(GConfig)
	GConfig->GetString(
		*VictoryGameConfigCoreSection,
		TEXT("RootDir"),
		VictoryMainDirectoryName,
		GGameIni
	);
	
	//Set a Default Name
		//dir/windowsnoeditor/VictoryGame/saved/windowsnoeditor/config/game.ini
	if(VictoryMainDirectoryName == "")
	{
		GConfig->SetString (
			*VictoryGameConfigCoreSection,
			TEXT("RootDir"),
			TEXT("E:\\SameDir_As_ShortCut_Is_To_RunGame"),
			GGameIni
		);
	}
	else Optimize(VictoryMainDirectoryName);
	
	Optimize("~~~~~~~~~~~~~~");
	Optimize("Root Dir:");
	Optimize(VictoryMainDirectoryName);
	Optimize("~~~~~~~~~~~~~~\n");

#Summary

Why would useing -SaveToUserDir

cause this code to fail?

 if(GConfig)
    	GConfig->GetString(
    		*VictoryGameConfigCoreSection,
    		TEXT("RootDir"),
    		VictoryMainDirectoryName,
    		GGameIni
    	);

#Idea

It would seem that the config system is internally changing its implementation to somehow look at the user’s documents folder for config files instead?

I have no idea how to override that behavior :slight_smile:

Rama

Windows (and possibly other platforms) put lots of restrictions on where files that are user writeable can reside. Anything in the “program files” directory structure has a lot of rules I haven’t tried to understand (there are others that thankfully do).

So when shipping (or specified), all the user generated files (logs/ini/screenshots/etc) moves to the user directory structure. This also allows multiple users to modify their configs without affecting each other.

I’m guessing what you experienced was you modified your non-default versions of the config files and then when you started using -SaveToUserDir those changes weren’t present in the newly created versions?

Glad the problem is resolved.

#Thanks for Being Awesome Josh!

Hee hee yup, it’s all fixed now!

And with my C++ compressed binary save system in place (ZLIB)

(I wrote tutorial for the community here)
http://forums.epicgames.com/threads/972861-41-TUTORIALS-C-for-UE4-gt-gt-New-Make-a-Custom-C-Save-System-to-Compressed-Binary?p=31782451&viewfull=1#post31782451

I now have a fully functional commerical-ready save system for my game where the end user just needs to run whatever the base Rocket installation process will be

#Yay!

#Thanks for your help Josh!

#:heart:

Rama

#Okay Nevermind

Ahh nevermind

I see that a copy of the Saved/Windows folder structure has been created

in my User Documents folder

Neat!

This is actually super-awesome

Thanks Epic for being so Awesome!

And thanks Josh for answering Pinheiro’s question, which has now benfitted me enormously!

Rama