mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- added M_GetDocumentsPath function.
This commit is contained in:
parent
cea89ba3ae
commit
a945418ba6
4 changed files with 73 additions and 0 deletions
|
@ -60,5 +60,6 @@ FString M_GetCajunPath(const char *filename);
|
|||
FString M_GetConfigPath(bool for_reading);
|
||||
FString M_GetScreenshotsPath();
|
||||
FString M_GetSavegamesPath();
|
||||
FString M_GetDocumentsPath();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -215,3 +215,24 @@ FString M_GetSavegamesPath()
|
|||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetDocumentsPath Unix
|
||||
//
|
||||
// Returns the path to the default documents directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetDocumentsPath()
|
||||
{
|
||||
FString path;
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -218,3 +218,16 @@ FString M_GetSavegamesPath()
|
|||
{
|
||||
return NicePath("~/" GAME_DIR);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetDocumentsPath Unix
|
||||
//
|
||||
// Returns the path to the default documents directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetDocumentsPath()
|
||||
{
|
||||
return NicePath("~/" GAME_DIR);
|
||||
}
|
|
@ -380,3 +380,41 @@ FString M_GetSavegamesPath()
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetDocumentsPath Windows
|
||||
//
|
||||
// Returns the path to the default documents directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetDocumentsPath()
|
||||
{
|
||||
FString path;
|
||||
|
||||
// A portable INI means that this storage location should also be portable.
|
||||
path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars());
|
||||
if (FileExists(path))
|
||||
{
|
||||
return progdir;
|
||||
}
|
||||
|
||||
if (!UseKnownFolders())
|
||||
{
|
||||
return progdir;
|
||||
}
|
||||
// Try defacto My Documents/My Games folder
|
||||
else if (GetKnownFolder(CSIDL_PERSONAL, FOLDERID_Documents, true, path))
|
||||
{
|
||||
// I assume since this isn't a standard folder, it doesn't have
|
||||
// a localized name either.
|
||||
path << "/My Games/" GAMENAME;
|
||||
CreatePath(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
path = progdir;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue