Some indentation fixes etc.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10321 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-07-07 19:00:02 +00:00
parent fb177fe538
commit df8ea1d187

View file

@ -358,9 +358,10 @@ NSTemporaryDirectory(void)
NSString * NSString *
NSOpenStepRootDirectory(void) NSOpenStepRootDirectory(void)
{ {
NSString *root = [[[NSProcessInfo processInfo] environment] NSString *root;
objectForKey: @"GNUSTEP_ROOT"];
root = [[[NSProcessInfo processInfo] environment]
objectForKey: @"GNUSTEP_ROOT"];
if (root == nil) if (root == nil)
#if defined(__MINGW__) #if defined(__MINGW__)
root = @"C:\\"; root = @"C:\\";
@ -372,31 +373,31 @@ NSOpenStepRootDirectory(void)
NSArray * NSArray *
NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey, NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
NSSearchPathDomainMask domainMask, NSSearchPathDomainMask domainMask, BOOL expandTilde)
BOOL expandTilde)
{ {
/* We read these four only once */ /* We read these four only once */
static NSString *gnustep_user_root = nil; /* GNUSTEP_USER_ROOT */ static NSString *gnustep_user_root = nil; /* GNUSTEP_USER_ROOT */
static NSString *gnustep_local_root = nil; /* GNUSTEP_LOCAL_ROOT */ static NSString *gnustep_local_root = nil; /* GNUSTEP_LOCAL_ROOT */
static NSString *gnustep_network_root = nil; /* GNUSTEP_NETWORK_ROOT */ static NSString *gnustep_network_root = nil; /* GNUSTEP_NETWORK_ROOT */
static NSString *gnustep_system_root = nil; /* GNUSTEP_SYSTEM_ROOT */ static NSString *gnustep_system_root = nil; /* GNUSTEP_SYSTEM_ROOT */
NSFileManager *fm; NSFileManager *fm;
NSString *adminDir = @"Administrator"; NSString *adminDir = @"Administrator";
NSString *appsDir = @"Apps"; NSString *appsDir = @"Apps";
NSString *demosDir = @"Demos"; NSString *demosDir = @"Demos";
NSString *devDir = @"Developer"; NSString *devDir = @"Developer";
NSString *libraryDir = @"Library"; NSString *libraryDir = @"Library";
NSString *libsDir = @"Libraries"; NSString *libsDir = @"Libraries";
NSString *docDir = @"Documentation"; NSString *docDir = @"Documentation";
NSMutableArray *paths = [NSMutableArray new]; NSMutableArray *paths = [NSMutableArray new];
NSString *path; NSString *path;
unsigned i, count; unsigned i;
unsigned count;
if (gnustep_system_root == nil) if (gnustep_system_root == nil)
{ {
NS_DURING NS_DURING
{ {
NSDictionary *env; NSDictionary *env;
[gnustep_global_lock lock]; [gnustep_global_lock lock];
@ -409,18 +410,20 @@ NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
TEST_RETAIN (gnustep_system_root); TEST_RETAIN (gnustep_system_root);
if (gnustep_system_root == nil) if (gnustep_system_root == nil)
{ {
/* This is pretty important as we need it to load /*
character sets, language settings and similar * This is pretty important as we need it to load
resources. Use fprintf to avoid recursive calls. */ * character sets, language settings and similar
* resources. Use fprintf to avoid recursive calls.
*/
fprintf (stderr, fprintf (stderr,
"Warning - GNUSTEP_SYSTEM_ROOT is not set " "Warning - GNUSTEP_SYSTEM_ROOT is not set "
"- using /usr/GNUstep/System as a default\n"); "- using /usr/GNUstep/System as a default\n");
gnustep_system_root = @"/usr/GNUstep/System"; gnustep_system_root = @"/usr/GNUstep/System";
} }
gnustep_local_root = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"]; gnustep_local_root = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
TEST_RETAIN (gnustep_local_root); TEST_RETAIN (gnustep_local_root);
gnustep_network_root = [env objectForKey: gnustep_network_root = [env objectForKey:
@"GNUSTEP_NETWORK_ROOT"]; @"GNUSTEP_NETWORK_ROOT"];
TEST_RETAIN (gnustep_network_root); TEST_RETAIN (gnustep_network_root);
gnustep_user_root = [env objectForKey: @"GNUSTEP_USER_ROOT"]; gnustep_user_root = [env objectForKey: @"GNUSTEP_USER_ROOT"];
TEST_RETAIN (gnustep_user_root); TEST_RETAIN (gnustep_user_root);
@ -435,16 +438,20 @@ NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directoryKey,
[localException raise]; [localException raise];
} }
NS_ENDHANDLER NS_ENDHANDLER
} }
/* The order in which we return paths is important - user must come /*
first, followed by local, followed by network, followed by system. * The order in which we return paths is important - user must come
The calling code can then loop on the returned paths, and stop as * first, followed by local, followed by network, followed by system.
soon as it finds something. So things in user automatically * The calling code can then loop on the returned paths, and stop as
override things in system etc. */ * soon as it finds something. So things in user automatically
* override things in system etc.
*/
/* FIXME - The following code will not respect this order for /*
NSAllApplicationsDirectory. This should be fixed I think. */ * FIXME - The following code will not respect this order for
* NSAllApplicationsDirectory. This should be fixed I think.
*/
#define ADD_PATH(mask, base_dir, add_dir) \ #define ADD_PATH(mask, base_dir, add_dir) \
if (domainMask & mask) \ if (domainMask & mask) \
@ -455,7 +462,7 @@ if (domainMask & mask) \
} }
if (directoryKey == NSApplicationDirectory if (directoryKey == NSApplicationDirectory
|| directoryKey == NSAllApplicationsDirectory) || directoryKey == NSAllApplicationsDirectory)
{ {
ADD_PATH (NSUserDomainMask, gnustep_user_root, appsDir); ADD_PATH (NSUserDomainMask, gnustep_user_root, appsDir);
ADD_PATH (NSLocalDomainMask, gnustep_local_root, appsDir); ADD_PATH (NSLocalDomainMask, gnustep_local_root, appsDir);
@ -463,13 +470,13 @@ if (domainMask & mask) \
ADD_PATH (NSSystemDomainMask, gnustep_system_root, appsDir); ADD_PATH (NSSystemDomainMask, gnustep_system_root, appsDir);
} }
if (directoryKey == NSDemoApplicationDirectory if (directoryKey == NSDemoApplicationDirectory
|| directoryKey == NSAllApplicationsDirectory); || directoryKey == NSAllApplicationsDirectory);
{ {
NSString *devDemosDir = [devDir stringByAppendingPathComponent: demosDir]; NSString *devDemosDir = [devDir stringByAppendingPathComponent: demosDir];
ADD_PATH (NSSystemDomainMask, gnustep_system_root, devDemosDir); ADD_PATH (NSSystemDomainMask, gnustep_system_root, devDemosDir);
} }
if (directoryKey == NSDeveloperApplicationDirectory if (directoryKey == NSDeveloperApplicationDirectory
|| directoryKey == NSAllApplicationsDirectory) || directoryKey == NSAllApplicationsDirectory)
{ {
NSString *devAppsDir = [devDir stringByAppendingPathComponent: appsDir]; NSString *devAppsDir = [devDir stringByAppendingPathComponent: appsDir];
@ -508,7 +515,7 @@ if (domainMask & mask) \
if (domainMask & NSUserDomainMask) if (domainMask & NSUserDomainMask)
{ {
path = [NSHomeDirectory() stringByAppendingPathComponent: path = [NSHomeDirectory() stringByAppendingPathComponent:
@"GNUstep"]; @"GNUstep"];
[paths addObject: path]; [paths addObject: path];
} }
} }
@ -549,12 +556,12 @@ if (domainMask & mask) \
else if (expandTilde == YES) else if (expandTilde == YES)
{ {
[paths replaceObjectAtIndex: i [paths replaceObjectAtIndex: i
withObject: [path stringByExpandingTildeInPath]]; withObject: [path stringByExpandingTildeInPath]];
} }
else else
{ {
[paths replaceObjectAtIndex: i [paths replaceObjectAtIndex: i
withObject: [path stringByAbbreviatingWithTildeInPath]]; withObject: [path stringByAbbreviatingWithTildeInPath]];
} }
} }