- Look for files in Mac-like places on Macs.
- Fixed: The non-Windows CreatePath can fail if part of the path already exists, because mkdir will return an error code for trying to recreate an existing directory. SVN r1814 (trunk)
This commit is contained in:
parent
12576d2eb5
commit
66920536d9
9 changed files with 119 additions and 100 deletions
|
|
@ -27,6 +27,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
#ifdef __APPLE__
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
#include "templates.h"
|
||||
#include "version.h"
|
||||
|
|
@ -1812,7 +1815,7 @@ FString G_BuildSaveName (const char *prefix, int slot)
|
|||
leader = Args->CheckValue ("-savedir");
|
||||
if (leader.IsEmpty())
|
||||
{
|
||||
#ifndef unix
|
||||
#if !defined(unix) && !defined(__APPLE__)
|
||||
if (Args->CheckParm ("-cdrom"))
|
||||
{
|
||||
leader = CDROM_DIR "/";
|
||||
|
|
@ -1827,6 +1830,18 @@ FString G_BuildSaveName (const char *prefix, int slot)
|
|||
{
|
||||
leader = "~/" GAME_DIR;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
if (leader.IsEmpty())
|
||||
{
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
leader << cpath << "/" GAME_DIR "/Savegames/";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
size_t len = leader.Len();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue