mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-30 16:01:49 +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
|
||||
- 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
|
||||
mouse should be grabbed. This fixes the case where you start the game in
|
||||
the background and it grabs the mouse anyway.
|
||||
|
|
|
@ -369,15 +369,18 @@ void DoCreatePath(const char * fn)
|
|||
|
||||
void CreatePath(const char *fn)
|
||||
{
|
||||
char name[PATH_MAX];
|
||||
char c = fn[strlen(fn)-1];
|
||||
|
||||
if (c != '\\' && c != '/')
|
||||
{
|
||||
mysnprintf(name, countof(name), "%s/", fn);
|
||||
FString name(fn);
|
||||
name += '/';
|
||||
DoCreatePath(name);
|
||||
}
|
||||
else DoCreatePath(fn);
|
||||
else
|
||||
{
|
||||
DoCreatePath(fn);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void CreatePath(const char *fn)
|
||||
|
|
|
@ -1777,24 +1777,27 @@ FString G_BuildSaveName (const char *prefix, int slot)
|
|||
{
|
||||
leader = save_dir;
|
||||
}
|
||||
#ifdef unix
|
||||
if (leader.IsEmpty())
|
||||
{
|
||||
leader = "~" GAME_DIR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
size_t len = leader.Len();
|
||||
if (leader[0] != '\0' && leader[len-1] != '\\' && leader[len-1] != '/')
|
||||
{
|
||||
slash = "/";
|
||||
}
|
||||
name.Format("%s%s%s", leader.GetChars(), slash, prefix);
|
||||
name << leader << slash;
|
||||
name = NicePath(name);
|
||||
CreatePath(name);
|
||||
name << prefix;
|
||||
if (slot >= 0)
|
||||
{
|
||||
name.AppendFormat("%d.zds", slot);
|
||||
}
|
||||
#ifdef unix
|
||||
if (leader[0] == 0)
|
||||
{
|
||||
return GetUserFile (name);
|
||||
}
|
||||
#endif
|
||||
return NicePath(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
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;
|
||||
G_SnapshotLevel ();
|
||||
|
||||
FILE *stdfile = fopen (filename.GetChars(), "wb");
|
||||
FILE *stdfile = fopen (filename, "wb");
|
||||
|
||||
if (stdfile == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue