mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 09:51:40 +00:00
Use NSFileManager methods instead of access().
This even fixes a bug where an inaccessible bspSound was being opened.
This commit is contained in:
parent
f105fbd6a0
commit
8e13a8327d
2 changed files with 4 additions and 3 deletions
|
@ -130,7 +130,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
// Set the bspSound path
|
// Set the bspSound path
|
||||||
- (id) setBspSoundPath: (NSString *)path
|
- (id) setBspSoundPath: (NSString *)path
|
||||||
{
|
{
|
||||||
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
[path retain];
|
[path retain];
|
||||||
[bspSound release];
|
[bspSound release];
|
||||||
bspSound = path;
|
bspSound = path;
|
||||||
|
@ -139,7 +139,7 @@ WriteNumericDefault (id prefs, NSString *name, float value)
|
||||||
[bspSound_i release];
|
[bspSound_i release];
|
||||||
bspSound_i = nil;
|
bspSound_i = nil;
|
||||||
}
|
}
|
||||||
if (access ([path cString], R_OK)) {
|
if ([fm isReadableFileAtPath: bspSound]) {
|
||||||
bspSound_i = [[NSSound alloc] initWithContentsOfFile: bspSound
|
bspSound_i = [[NSSound alloc] initWithContentsOfFile: bspSound
|
||||||
byReference: YES];
|
byReference: YES];
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,9 +256,10 @@ id project_i;
|
||||||
{
|
{
|
||||||
NSString *path;
|
NSString *path;
|
||||||
int rtn;
|
int rtn;
|
||||||
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
|
|
||||||
path = [preferences_i getProjectPath];
|
path = [preferences_i getProjectPath];
|
||||||
if (![path length] || access ([path cString], 0)) {
|
if (![path length] || ![fm fileExistsAtPath: path]) {
|
||||||
rtn = NSRunAlertPanel (@"Project Error!",
|
rtn = NSRunAlertPanel (@"Project Error!",
|
||||||
@"A default project has not been found.\n",
|
@"A default project has not been found.\n",
|
||||||
@"Open Project", NULL, NULL);
|
@"Open Project", NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue