diff --git a/ChangeLog b/ChangeLog index d581ffd84..55a9e2dab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Dec 15 13:25:10 1998 Adam Fedor + + * src/NSUser.m (NSFullUserName): New function (not implemented). + (NSStandardApplicationPaths): Likewise. + (NSStandardLibraryPaths): Likewise. + (NSTemporaryDirectory): New function (implemented). + (NSOpenStepRootDirectory): Likewise. + * src/include/NSPathUtilities.h: Defined new functions. + * src/include/NSUserDefaults.h: Removed duplicate definitions. + Mon Dec 14 6:30:00 1998 Richard Frith-Macdonald * src/GNUmakefile: Put mframe.h in a machine/os specific directory. diff --git a/Headers/gnustep/base/NSPathUtilities.h b/Headers/gnustep/base/NSPathUtilities.h index 2cbb136cb..057c9ef2e 100644 --- a/Headers/gnustep/base/NSPathUtilities.h +++ b/Headers/gnustep/base/NSPathUtilities.h @@ -29,6 +29,14 @@ extern NSString *NSUserName (); extern NSString *NSHomeDirectory (); -extern NSString *NSHomeDirectoryForUser (NSString *login_name); +extern NSString *NSHomeDirectoryForUser (NSString *userName); + +#ifndef STRICT_OPENSTEP +extern NSString *NSFullUserName(void); +extern NSArray *NSStandardApplicationPaths(void); +extern NSArray *NSStandardLibraryPaths(void); +extern NSString *NSTemporaryDirectory(void); +extern NSString *NSOpenStepRootDirectory(void); +#endif /* !STRICT_OPENSTEP */ #endif /* __NSPathUtilities_h_GNUSTEP_BASE_INCLUDE */ diff --git a/Headers/gnustep/base/NSUserDefaults.h b/Headers/gnustep/base/NSUserDefaults.h index b907c6a7c..87012426c 100644 --- a/Headers/gnustep/base/NSUserDefaults.h +++ b/Headers/gnustep/base/NSUserDefaults.h @@ -74,12 +74,6 @@ extern NSString* const NSPriorDayDesignations; extern NSString* const NSDateTimeOrdering; #endif -/* Get Information about a User */ -extern NSString *NSUserName(void); -extern NSString *NSHomeDirectory(void); -extern NSString *NSHomeDirectoryForUser(NSString * userName); - - /* General implementation notes: OpenStep spec currently is either complete nor consitent. Therefor diff --git a/Source/NSUser.m b/Source/NSUser.m index c807bd76c..94b1d0403 100644 --- a/Source/NSUser.m +++ b/Source/NSUser.m @@ -26,6 +26,11 @@ #include #include #include +#include +#include +#include +#include + #include // for getenv() #if !defined(__WIN32__) && !defined(_WIN32) #include // for getlogin() @@ -110,3 +115,60 @@ NSHomeDirectoryForUser (NSString *login_name) } #endif } + +NSString *NSFullUserName(void) +{ + NSLog(@"Warning: NSFullUserName not implemented\n"); + return NSUserName(); +} + +NSArray *NSStandardApplicationPaths(void) +{ + NSLog(@"Warning: NSStandardApplicationPaths not implemented\n"); + return [NSArray array]; +} + +NSArray *NSStandardLibraryPaths(void) +{ + NSLog(@"Warning: NSStandardLibraryPaths not implemented\n"); + return [NSArray array]; +} + +NSString *NSTemporaryDirectory(void) +{ + NSFileManager *manager; + NSString *tempDirName, *baseTempDirName; +#ifdef WIN32 + char buffer[1024]; + if (GetTempPath(1024, buffer)) + baseTempDirName = [NSString stringWithCString: buffer]; + else + baseTempDirName = @"C:\\"; +#else + baseTempDirName = @"/tmp"; +#endif + + tempDirName = [baseTempDirName stringByAppendingPathComponent: NSUserName()]; + manager = [NSFileManager defaultManager]; + if ([manager fileExistsAtPath: tempDirName] == NO) + { + NSDictionary *attr; + attr = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: 0700] + forKey: NSFilePosixPermissions]; + if ([manager createDirectoryAtPath: tempDirName attributes: attr] == NO) + tempDirName = baseTempDirName; + } + + return tempDirName; +} + +NSString *NSOpenStepRootDirectory(void) +{ +#ifdef WIN32 + return @"C:\\"; +#else + return @"/"; +#endif +} + +