MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / saveConfig

Function saveConfig

TheForceEngine/TFE_Editor/editorConfig.cpp:99–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98
99 bool saveConfig()
100 {
101 char editorPath[TFE_MAX_PATH];
102 TFE_Paths::appendPath(PATH_USER_DOCUMENTS, "editor.ini", editorPath);
103
104 FileStream configFile;
105 if (!configFile.open(editorPath, Stream::MODE_WRITE))
106 {
107 return false;
108 }
109
110 TFE_IniParser::writeKeyValue_String(configFile, "EditorPath", s_editorConfig.editorPath);
111 TFE_IniParser::writeKeyValue_String(configFile, "ExportPath", s_editorConfig.exportPath);
112 TFE_IniParser::writeKeyValue_Int(configFile, "FontScale", s_editorConfig.fontScale);
113 TFE_IniParser::writeKeyValue_Int(configFile, "ThumbnailSize", s_editorConfig.thumbnailSize);
114
115 // Level Editor
116 TFE_IniParser::writeKeyValue_Int(configFile, "Interface_Flags", s_editorConfig.interfaceFlags);
117 TFE_IniParser::writeKeyValue_Float(configFile, "Curve_SegmentSize", s_editorConfig.curve_segmentSize);
118 TFE_IniParser::writeKeyValue_String(configFile, "DarkForcesPort", s_editorConfig.darkForcesPort);
119 TFE_IniParser::writeKeyValue_String(configFile, "OutlawsPort", s_editorConfig.outlawsPort);
120 TFE_IniParser::writeKeyValue_String(configFile, "DarkForcesAddCmdLine", s_editorConfig.darkForcesAddCmdLine);
121 TFE_IniParser::writeKeyValue_String(configFile, "OutlawsAddCmdLine", s_editorConfig.outlawsAddCmdLine);
122 TFE_IniParser::writeKeyValue_Int(configFile, "LevelEditorFlags", s_editorConfig.levelEditorFlags);
123
124 // Recent files.
125 std::vector<RecentProject>* recentProjects = getRecentProjects();
126 if (recentProjects && !recentProjects->empty())
127 {
128 char key[256];
129 const s32 count = (s32)recentProjects->size();
130 for (s32 i = 0; i < count; i++)
131 {
132 sprintf(key, "Recent[%d]", i);
133 TFE_IniParser::writeKeyValue_String(configFile, key, (*recentProjects)[i].path.c_str());
134 }
135 }
136
137 // Keybindings
138 LevelEditor::writeLevelEditorShortcuts(configFile);
139
140 configFile.close();
141 s_configLoaded = true;
142 return true;
143 }
144
145 void fontScaleControl()
146 {

Callers 6

handlePopupEndFunction · 0.85
menuFunction · 0.85
addToRecentsFunction · 0.85
configUiFunction · 0.85
testOptionsFunction · 0.85
userPreferencesFunction · 0.85

Calls 11

writeKeyValue_StringFunction · 0.85
writeKeyValue_IntFunction · 0.85
writeKeyValue_FloatFunction · 0.85
getRecentProjectsFunction · 0.85
c_strMethod · 0.80
appendPathFunction · 0.50
openMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
closeMethod · 0.45

Tested by 1

testOptionsFunction · 0.68