mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Specifying non-existent directories with -savedir or the save_dir cvar now
attempts to create them. SVN r1607 (trunk)
This commit is contained in:
parent
e95be7eff7
commit
2f7498214b
3 changed files with 23 additions and 15 deletions
|
@ -1,4 +1,6 @@
|
||||||
May 25, 2009
|
May 25, 2009
|
||||||
|
- Specifiying non-existant directories with -savedir or the save_dir cvar now
|
||||||
|
attempts to create them.
|
||||||
- I_CheckNativeMouse() now checks the foreground window to determine if the
|
- I_CheckNativeMouse() now checks the foreground window to determine if the
|
||||||
mouse should be grabbed. This fixes the case where you start the game in
|
mouse should be grabbed. This fixes the case where you start the game in
|
||||||
the background and it grabs the mouse anyway.
|
the background and it grabs the mouse anyway.
|
||||||
|
|
|
@ -352,7 +352,7 @@ const char *myasctime ()
|
||||||
/* */
|
/* */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void DoCreatePath(const char * fn)
|
void DoCreatePath(const char *fn)
|
||||||
{
|
{
|
||||||
char drive[_MAX_DRIVE];
|
char drive[_MAX_DRIVE];
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
@ -367,17 +367,20 @@ void DoCreatePath(const char * fn)
|
||||||
_mkdir(p);
|
_mkdir(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePath(const char * fn)
|
void CreatePath(const char *fn)
|
||||||
{
|
{
|
||||||
char name[PATH_MAX];
|
|
||||||
char c = fn[strlen(fn)-1];
|
char c = fn[strlen(fn)-1];
|
||||||
|
|
||||||
if (c!='\\' && c!='/')
|
if (c != '\\' && c != '/')
|
||||||
{
|
{
|
||||||
mysnprintf(name, countof(name), "%s/", fn);
|
FString name(fn);
|
||||||
|
name += '/';
|
||||||
DoCreatePath(name);
|
DoCreatePath(name);
|
||||||
}
|
}
|
||||||
else DoCreatePath(fn);
|
else
|
||||||
|
{
|
||||||
|
DoCreatePath(fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void CreatePath(const char *fn)
|
void CreatePath(const char *fn)
|
||||||
|
|
|
@ -1777,24 +1777,27 @@ FString G_BuildSaveName (const char *prefix, int slot)
|
||||||
{
|
{
|
||||||
leader = save_dir;
|
leader = save_dir;
|
||||||
}
|
}
|
||||||
|
#ifdef unix
|
||||||
|
if (leader.IsEmpty())
|
||||||
|
{
|
||||||
|
leader = "~" GAME_DIR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
size_t len = leader.Len();
|
size_t len = leader.Len();
|
||||||
if (leader[0] != '\0' && leader[len-1] != '\\' && leader[len-1] != '/')
|
if (leader[0] != '\0' && leader[len-1] != '\\' && leader[len-1] != '/')
|
||||||
{
|
{
|
||||||
slash = "/";
|
slash = "/";
|
||||||
}
|
}
|
||||||
name.Format("%s%s%s", leader.GetChars(), slash, prefix);
|
name << leader << slash;
|
||||||
|
name = NicePath(name);
|
||||||
|
CreatePath(name);
|
||||||
|
name << prefix;
|
||||||
if (slot >= 0)
|
if (slot >= 0)
|
||||||
{
|
{
|
||||||
name.AppendFormat("%d.zds", slot);
|
name.AppendFormat("%d.zds", slot);
|
||||||
}
|
}
|
||||||
#ifdef unix
|
return name;
|
||||||
if (leader[0] == 0)
|
|
||||||
{
|
|
||||||
return GetUserFile (name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return NicePath(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
@ -1911,7 +1914,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
|
||||||
insave = true;
|
insave = true;
|
||||||
G_SnapshotLevel ();
|
G_SnapshotLevel ();
|
||||||
|
|
||||||
FILE *stdfile = fopen (filename.GetChars(), "wb");
|
FILE *stdfile = fopen (filename, "wb");
|
||||||
|
|
||||||
if (stdfile == NULL)
|
if (stdfile == NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue