Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 04a8fc4

Browse files
committed
Generate quick launch batch files on first boot (Settings.ini doesn't exist) if they are missing for Windows only
Hate having these shit up the data repo
1 parent c422067 commit 04a8fc4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

System/System.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ namespace RTE {
3232
if (!PathExistsCaseSensitive(s_WorkingDirectory + s_ScreenshotDirectory)) { MakeDirectory(s_WorkingDirectory + s_ScreenshotDirectory); }
3333
if (!PathExistsCaseSensitive(s_WorkingDirectory + s_ModDirectory)) { MakeDirectory(s_WorkingDirectory + s_ModDirectory); }
3434
if (!PathExistsCaseSensitive(s_WorkingDirectory + s_UserdataDirectory)) { MakeDirectory(s_WorkingDirectory + s_UserdataDirectory); }
35+
36+
#ifdef _WIN32
37+
// Consider Settings.ini not existing as first time boot, then create quick launch files if they are missing.
38+
if (!std::filesystem::exists(s_WorkingDirectory + s_UserdataDirectory + "Settings.ini")) {
39+
std::array<std::pair<const std::string, const std::string>, 7> quickLaunchFiles = {{
40+
{ "Launch Actor Editor.bat", R"(start "" "Cortex Command.exe" -editor "ActorEditor")" },
41+
{ "Launch Area Editor.bat", R"(start "" "Cortex Command.exe" -editor "AreaEditor")" },
42+
{ "Launch Assembly Editor.bat", R"(start "" "Cortex Command.exe" -editor "AssemblyEditor")" },
43+
{ "Launch Gib Editor.bat", R"(start "" "Cortex Command.exe" -editor "GibEditor")" },
44+
{ "Launch Scene Editor.bat", R"(start "" "Cortex Command.exe" -editor "SceneEditor")" },
45+
#ifdef TARGET_MACHINE_X86
46+
{ "Start Dedicated Server x86.bat", R"(start "" "Cortex Command x86.exe" -server 8000)" },
47+
#else
48+
{ "Start Dedicated Server.bat", R"(start "" "Cortex Command.exe" -server 8000)" },
49+
#endif
50+
}};
51+
for (const auto &[fileName, fileContent] : quickLaunchFiles) {
52+
if (std::filesystem::path filePath = s_WorkingDirectory + fileName; !std::filesystem::exists(filePath)) {
53+
std::ofstream fileStream(filePath);
54+
fileStream << fileContent;
55+
fileStream.close();
56+
}
57+
}
58+
}
59+
#endif
3560
}
3661

3762
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)