mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-20 18:02:29 +00:00
- fix issue #1708 - respect user preferences when specifying custom save/config/screenshot paths
This commit is contained in:
parent
dd07f6513f
commit
03d76027cf
5 changed files with 68 additions and 18 deletions
|
@ -54,9 +54,6 @@
|
|||
#include "md5.h"
|
||||
#include "i_specialpaths.h"
|
||||
|
||||
void I_OpenShellFolder(const char*);
|
||||
void I_OpenShellFile(const char*);
|
||||
|
||||
extern FILE* Logfile;
|
||||
|
||||
CCMD (quit)
|
||||
|
@ -341,18 +338,3 @@ CCMD(printlocalized)
|
|||
|
||||
}
|
||||
|
||||
CCMD(opensaves)
|
||||
{
|
||||
I_OpenShellFolder(M_GetSavegamesPath().GetChars());
|
||||
}
|
||||
|
||||
CCMD(openscreenshots)
|
||||
{
|
||||
I_OpenShellFolder(M_GetScreenshotsPath().GetChars());
|
||||
}
|
||||
|
||||
CCMD(openconfig)
|
||||
{
|
||||
I_OpenShellFile(M_GetConfigPath(false).GetChars());
|
||||
}
|
||||
|
||||
|
|
|
@ -69,4 +69,7 @@ inline int I_GetNumaNodeCount() { return 1; }
|
|||
inline int I_GetNumaNodeThreadCount(int numaNode) { return std::max<int>(std::thread::hardware_concurrency(), 1); }
|
||||
inline void I_SetThreadNumaNode(std::thread &thread, int numaNode) { }
|
||||
|
||||
void I_OpenShellFolder(const char*);
|
||||
void I_OpenShellFile(const char*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,4 +79,7 @@ int I_GetNumaNodeCount();
|
|||
int I_GetNumaNodeThreadCount(int numaNode);
|
||||
void I_SetThreadNumaNode(std::thread &thread, int numaNode);
|
||||
|
||||
void I_OpenShellFolder(const char*);
|
||||
void I_OpenShellFile(const char*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2197,6 +2197,33 @@ FString G_BuildSaveName (const char *prefix, int slot)
|
|||
return name;
|
||||
}
|
||||
|
||||
CCMD(opensaves)
|
||||
{
|
||||
FString name;
|
||||
FString leader;
|
||||
const char *slash = "";
|
||||
|
||||
leader = Args->CheckValue ("-savedir");
|
||||
if (leader.IsEmpty())
|
||||
{
|
||||
leader = save_dir;
|
||||
if (leader.IsEmpty())
|
||||
{
|
||||
leader = M_GetSavegamesPath();
|
||||
}
|
||||
}
|
||||
size_t len = leader.Len();
|
||||
if (leader[0] != '\0' && leader[len-1] != '\\' && leader[len-1] != '/')
|
||||
{
|
||||
slash = "/";
|
||||
}
|
||||
name << leader << slash;
|
||||
name = NicePath(name);
|
||||
CreatePath(name);
|
||||
|
||||
I_OpenShellFolder(name);
|
||||
}
|
||||
|
||||
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
static int nextautosave = -1;
|
||||
CVAR (Int, disableautosave, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
|
|
@ -313,6 +313,12 @@ UNSAFE_CCMD (writeini)
|
|||
}
|
||||
}
|
||||
|
||||
CCMD(openconfig)
|
||||
{
|
||||
M_SaveDefaults(nullptr);
|
||||
I_OpenShellFile(GameConfig->GetPathName());
|
||||
}
|
||||
|
||||
//
|
||||
// M_LoadDefaults
|
||||
//
|
||||
|
@ -657,3 +663,32 @@ UNSAFE_CCMD (screenshot)
|
|||
G_ScreenShot (argv[1]);
|
||||
}
|
||||
|
||||
CCMD(openscreenshots)
|
||||
{
|
||||
size_t dirlen;
|
||||
FString autoname;
|
||||
autoname = Args->CheckValue("-shotdir");
|
||||
if (autoname.IsEmpty())
|
||||
{
|
||||
autoname = screenshot_dir;
|
||||
}
|
||||
dirlen = autoname.Len();
|
||||
if (dirlen == 0)
|
||||
{
|
||||
autoname = M_GetScreenshotsPath();
|
||||
dirlen = autoname.Len();
|
||||
}
|
||||
if (dirlen > 0)
|
||||
{
|
||||
if (autoname[dirlen-1] != '/' && autoname[dirlen-1] != '\\')
|
||||
{
|
||||
autoname += '/';
|
||||
}
|
||||
}
|
||||
autoname = NicePath(autoname);
|
||||
|
||||
CreatePath(autoname);
|
||||
|
||||
I_OpenShellFolder(autoname.GetChars());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue