diff --git a/src/common/console/c_enginecmds.cpp b/src/common/console/c_enginecmds.cpp index 0845ac8227..d2d2796192 100644 --- a/src/common/console/c_enginecmds.cpp +++ b/src/common/console/c_enginecmds.cpp @@ -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()); -} - diff --git a/src/common/platform/posix/i_system.h b/src/common/platform/posix/i_system.h index b73261eafb..48c56956e2 100644 --- a/src/common/platform/posix/i_system.h +++ b/src/common/platform/posix/i_system.h @@ -69,4 +69,7 @@ inline int I_GetNumaNodeCount() { return 1; } inline int I_GetNumaNodeThreadCount(int numaNode) { return std::max(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 diff --git a/src/common/platform/win32/i_system.h b/src/common/platform/win32/i_system.h index 648d8705e9..277bcca570 100644 --- a/src/common/platform/win32/i_system.h +++ b/src/common/platform/win32/i_system.h @@ -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 diff --git a/src/g_game.cpp b/src/g_game.cpp index 73e1e5314f..e66bea5e2c 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -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) diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 6680911acc..bbe4e1207e 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -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()); +} +