Fix /todo failing when launching from program folder without proper access permissions.

Write the TODO.txt at user path instead.
shapetextures
Sven Eberhardt 2015-09-13 00:13:08 -04:00
parent a40792013f
commit 288de8c89f
2 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,7 @@ void C4ConfigDeveloper::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(AutoFileReload, "AutoFileReload", 1 , false, true));
pComp->Value(mkNamingAdapt(ExtraWarnings, "ExtraWarnings", 0 , false, true));
pComp->Value(mkNamingAdapt(s(TodoFilename), "TodoFilename", "{SCENARIO}/TODO.txt", false, true));
pComp->Value(mkNamingAdapt(s(AltTodoFilename), "AltTodoFilename", "TODO.txt" , false, true));
pComp->Value(mkNamingAdapt(s(AltTodoFilename), "AltTodoFilename2", "{USERPATH}/TODO.txt", false, true));
}
void C4ConfigGraphics::CompileFunc(StdCompiler *pComp)

View File

@ -782,6 +782,7 @@ bool C4MessageInput::ProcessCommand(const char *szCommand)
for (int i = 0; i < static_cast<int>(std::extent<decltype(todo_filenames)>::value); ++i)
{
StdCopyStrBuf todo_filename(todo_filenames[i]);
todo_filename.Replace("{USERPATH}", Config.General.UserDataPath);
int replacements = todo_filename.Replace("{SCENARIO}", Game.ScenarioFile.GetFullName().getData());
// sanity check if entered in editor with no file open
if (replacements && !Game.ScenarioFile.IsOpen()) continue;