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,6 +111,8 @@ static NSString *_rootPath = @"/";
*/ */
extPrefPath = [home stringByAppendingPathComponent: extPrefName]; extPrefPath = [home stringByAppendingPathComponent: extPrefName];
[extPrefPath retain]; [extPrefPath retain];
if ([mgr isReadableFileAtPath: extPrefPath] == YES)
{
data = [NSData dataWithContentsOfFile: extPrefPath]; data = [NSData dataWithContentsOfFile: extPrefPath];
if (data) if (data)
{ {
@ -117,12 +120,15 @@ static NSString *_rootPath = @"/";
mutableContainers: NO]; mutableContainers: NO];
extPreferences = [dict retain]; extPreferences = [dict retain];
} }
}
/* /*
* Load cached application information. * Load cached application information.
*/ */
appListPath = [home stringByAppendingPathComponent: appListName]; appListPath = [home stringByAppendingPathComponent: appListName];
[appListPath retain]; [appListPath retain];
if ([mgr isReadableFileAtPath: appListPath] == YES)
{
data = [NSData dataWithContentsOfFile: appListPath]; data = [NSData dataWithContentsOfFile: appListPath];
if (data) if (data)
{ {
@ -130,7 +136,7 @@ static NSString *_rootPath = @"/";
mutableContainers: NO]; mutableContainers: NO];
applications = [dict retain]; 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,6 +751,8 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
if (task != nil) if (task != nil)
[task waitUntilExit]; [task waitUntilExit];
if ([mgr isReadableFileAtPath: extPrefPath] == YES)
{
data = [NSData dataWithContentsOfFile: extPrefPath]; data = [NSData dataWithContentsOfFile: extPrefPath];
if (data) if (data)
{ {
@ -751,7 +760,10 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
mutableContainers: NO]; mutableContainers: NO];
ASSIGN(extPreferences, dict); ASSIGN(extPreferences, dict);
} }
}
if ([mgr isReadableFileAtPath: appListPath] == YES)
{
data = [NSData dataWithContentsOfFile: appListPath]; data = [NSData dataWithContentsOfFile: appListPath];
if (data) if (data)
{ {
@ -759,6 +771,7 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
mutableContainers: NO]; mutableContainers: NO];
ASSIGN(applications, dict); ASSIGN(applications, dict);
} }
}
/* /*
* Invalidate the cache of icons for file extensions. * Invalidate the cache of icons for file extensions.
*/ */