MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / GetPrefDir

Function GetPrefDir

Engine/source/platformPOSIX/POSIXFileio.cpp:243–263  ·  view source on GitHub ↗

get the "pref dir", which is where game output files are stored. the pref dir is ~/PREF_DIR_ROOT/PREF_DIR_GAME_NAME

Source from the content-addressed store, hash-verified

241// get the "pref dir", which is where game output files are stored. the pref
242// dir is ~/PREF_DIR_ROOT/PREF_DIR_GAME_NAME
243static const char* GetPrefDir()
244{
245 if (sgPrefDirInitialized)
246 return sgPrefDir;
247
248 if (sUseRedirect)
249 {
250 const char *home = getenv("HOME");
251 AssertFatal(home, "HOME environment variable must be set");
252
253 dSprintf(sgPrefDir, MaxPath, "%s/%s/%s",
254 home, PREF_DIR_ROOT, PREF_DIR_GAME_NAME);
255 }
256 else
257 {
258 getcwd(sgPrefDir, MaxPath);
259 }
260
261 sgPrefDirInitialized = true;
262 return sgPrefDir;
263}
264
265//-----------------------------------------------------------------------------
266// Returns true if the pathname exists, false otherwise. If isFile is true,

Callers 7

ModifyFileFunction · 0.85
dFileRenameFunction · 0.85
openMethod · 0.85
getFileTimesMethod · 0.85
createPathMethod · 0.85
dumpPathMethod · 0.85
getUserDataDirectoryMethod · 0.85

Calls 2

getenvFunction · 0.85
dSprintfFunction · 0.85

Tested by

no test coverage detected