Unbroken SDL builds.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3674 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2010-07-15 16:31:45 +00:00
parent 4803800f1f
commit 748b857484
3 changed files with 36 additions and 1 deletions

View File

@ -999,6 +999,7 @@ static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context)
[fmgr createDirectoryAtPath:path attributes:nil];
}
}
return url;
}
#else

View File

@ -30,11 +30,19 @@ MA 02110-1301, USA.
#define SAVEDIR "oolite-saves"
#if OOLITE_SDL
#define SNAPSHOTDIR "snapshots"
#endif
@interface NSFileManager (OOExtensions)
- (NSArray*) commanderContentsOfPath:(NSString*) savePath;
- (NSString*) defaultCommanderPath;
#if OOLITE_SDL
- (BOOL) chdirToSnapshotPath;
#endif
@end

View File

@ -27,10 +27,10 @@ MA 02110-1301, USA.
*/
#include <stdlib.h>
#import "NSFileManagerOOExtensions.h"
#import "ResourceManager.h"
#import "OOPListParsing.h"
#import "GameController.h"
#import "NSFileManagerOOExtensions.h"
#define kOOLogUnconvertedNSLog @"unclassified.NSFileManagerOOExtensions"
@ -116,6 +116,32 @@ MA 02110-1301, USA.
return savedir;
}
#if OOLITE_SDL
- (BOOL) chdirToSnapshotPath
{
// SDL: the default path for snapshots is oolite.app/oolite-saves/snapshots
NSString *savedir = [[NSHomeDirectory() stringByAppendingPathComponent:@SAVEDIR] stringByAppendingPathComponent:@SNAPSHOTDIR];
if (![self changeCurrentDirectoryPath: savedir])
{
// it probably doesn't exist.
if (![self createDirectoryAtPath: savedir attributes: nil])
{
OOLog(@"savedSnapshot.defaultPath.create.failed", @"Unable to create directory %@", savedir);
return NO;
}
if (![self changeCurrentDirectoryPath: savedir])
{
OOLog(@"savedSnapshot.defaultPath.chdir.failed", @"Created %@ but couldn't make it the current directory.", savedir);
return NO;
}
}
return YES;
}
#endif
@end