mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
Implement user functions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3463 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9e2a18c30e
commit
c316ccd6eb
4 changed files with 81 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Dec 15 13:25:10 1998 Adam Fedor <fedor@doc.com>
|
||||||
|
|
||||||
|
* 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 <richard@brainstorm.co.uk>
|
Mon Dec 14 6:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* src/GNUmakefile: Put mframe.h in a machine/os specific directory.
|
* src/GNUmakefile: Put mframe.h in a machine/os specific directory.
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
|
|
||||||
extern NSString *NSUserName ();
|
extern NSString *NSUserName ();
|
||||||
extern NSString *NSHomeDirectory ();
|
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 */
|
#endif /* __NSPathUtilities_h_GNUSTEP_BASE_INCLUDE */
|
||||||
|
|
|
@ -74,12 +74,6 @@ extern NSString* const NSPriorDayDesignations;
|
||||||
extern NSString* const NSDateTimeOrdering;
|
extern NSString* const NSDateTimeOrdering;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get Information about a User */
|
|
||||||
extern NSString *NSUserName(void);
|
|
||||||
extern NSString *NSHomeDirectory(void);
|
|
||||||
extern NSString *NSHomeDirectoryForUser(NSString * userName);
|
|
||||||
|
|
||||||
|
|
||||||
/* General implementation notes:
|
/* General implementation notes:
|
||||||
|
|
||||||
OpenStep spec currently is either complete nor consitent. Therefor
|
OpenStep spec currently is either complete nor consitent. Therefor
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
#include <gnustep/base/preface.h>
|
#include <gnustep/base/preface.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSPathUtilities.h>
|
#include <Foundation/NSPathUtilities.h>
|
||||||
|
#include <Foundation/NSArray.h>
|
||||||
|
#include <Foundation/NSDictionary.h>
|
||||||
|
#include <Foundation/NSFileManager.h>
|
||||||
|
#include <Foundation/NSValue.h>
|
||||||
|
|
||||||
#include <stdlib.h> // for getenv()
|
#include <stdlib.h> // for getenv()
|
||||||
#if !defined(__WIN32__) && !defined(_WIN32)
|
#if !defined(__WIN32__) && !defined(_WIN32)
|
||||||
#include <unistd.h> // for getlogin()
|
#include <unistd.h> // for getlogin()
|
||||||
|
@ -110,3 +115,60 @@ NSHomeDirectoryForUser (NSString *login_name)
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue