git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4157 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-04-28 14:22:19 +00:00
parent 3b497c4330
commit ad83de41ad

View file

@ -60,7 +60,7 @@ static NSString *appListName = @"Services/.GNUstepAppList";
static NSString *appListPath = nil; static NSString *appListPath = nil;
static NSDictionary *applications = nil; static NSDictionary *applications = nil;
static NSString *extPrefName = @".GNUstepExtPrefs"; static NSString *extPrefName = @"Services/.GNUstepExtPrefs";
static NSString *extPrefPath = nil; static NSString *extPrefPath = nil;
static NSDictionary *extPreferences = nil; static NSDictionary *extPreferences = nil;
@ -74,6 +74,7 @@ static NSString *_rootPath = @"/";
if (self == [NSWorkspace class]) if (self == [NSWorkspace class])
{ {
static BOOL beenHere; static BOOL beenHere;
NSFileManager *mgr = [NSFileManager defaultManager];
NSDictionary *env; NSDictionary *env;
NSString *home; NSString *home;
NSData *data; NSData *data;
@ -110,12 +111,15 @@ static NSString *_rootPath = @"/";
*/ */
extPrefPath = [home stringByAppendingPathComponent: extPrefName]; extPrefPath = [home stringByAppendingPathComponent: extPrefName];
[extPrefPath retain]; [extPrefPath retain];
data = [NSData dataWithContentsOfFile: extPrefPath]; if ([mgr isReadableFileAtPath: extPrefPath] == YES)
if (data)
{ {
dict = [NSDeserializer deserializePropertyListFromData: data data = [NSData dataWithContentsOfFile: extPrefPath];
mutableContainers: NO]; if (data)
extPreferences = [dict retain]; {
dict = [NSDeserializer deserializePropertyListFromData: data
mutableContainers: NO];
extPreferences = [dict retain];
}
} }
/* /*
@ -123,14 +127,16 @@ static NSString *_rootPath = @"/";
*/ */
appListPath = [home stringByAppendingPathComponent: appListName]; appListPath = [home stringByAppendingPathComponent: appListName];
[appListPath retain]; [appListPath retain];
data = [NSData dataWithContentsOfFile: appListPath]; if ([mgr isReadableFileAtPath: appListPath] == YES)
if (data)
{ {
dict = [NSDeserializer deserializePropertyListFromData: data data = [NSData dataWithContentsOfFile: appListPath];
mutableContainers: NO]; if (data)
applications = [dict retain]; {
dict = [NSDeserializer deserializePropertyListFromData: data
mutableContainers: NO];
applications = [dict retain];
}
} }
[gnustep_global_lock unlock]; [gnustep_global_lock unlock];
} }
} }
@ -729,6 +735,7 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
- (void) findApplications - (void) findApplications
{ {
static NSString *path = nil; static NSString *path = nil;
NSFileManager *mgr = [NSFileManager defaultManager];
NSData *data; NSData *data;
NSDictionary *dict; NSDictionary *dict;
NSTask *task; NSTask *task;
@ -744,20 +751,26 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
if (task != nil) if (task != nil)
[task waitUntilExit]; [task waitUntilExit];
data = [NSData dataWithContentsOfFile: extPrefPath]; if ([mgr isReadableFileAtPath: extPrefPath] == YES)
if (data)
{ {
dict = [NSDeserializer deserializePropertyListFromData: data data = [NSData dataWithContentsOfFile: extPrefPath];
mutableContainers: NO]; if (data)
ASSIGN(extPreferences, dict); {
dict = [NSDeserializer deserializePropertyListFromData: data
mutableContainers: NO];
ASSIGN(extPreferences, dict);
}
} }
data = [NSData dataWithContentsOfFile: appListPath]; if ([mgr isReadableFileAtPath: appListPath] == YES)
if (data)
{ {
dict = [NSDeserializer deserializePropertyListFromData: data data = [NSData dataWithContentsOfFile: appListPath];
mutableContainers: NO]; if (data)
ASSIGN(applications, dict); {
dict = [NSDeserializer deserializePropertyListFromData: data
mutableContainers: NO];
ASSIGN(applications, dict);
}
} }
/* /*
* Invalidate the cache of icons for file extensions. * Invalidate the cache of icons for file extensions.