preparation for osx compatibility fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35390 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-08-10 08:36:09 +00:00
parent 133bdaea80
commit 447db36958
10 changed files with 66 additions and 16 deletions

View file

@ -1,3 +1,16 @@
2012-08-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSpellServer.m:
* Source/NSPropertyList.m:
* Source/NSPathUtilities.m:
* Source/NSUserDefaults.m:
* Source/NSMessagePortNameServer.m:
* Source/NSDistributedLock.m:
* Source/NSMessagePort.m:
* Source/NSHTTPCookieStorage.m:
Use new method for creating intermediate directories rater than
depending on incorrect behavior of the old method.
2012-08-09 Richard Frith-Macdonald <rfm@gnu.org> 2012-08-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPropertyList.m: * Source/NSPropertyList.m:

View file

@ -192,7 +192,9 @@ static NSFileManager *mgr = nil;
forKey: NSFilePosixPermissions]; forKey: NSFilePosixPermissions];
locked = [mgr createDirectoryAtPath: _lockPath locked = [mgr createDirectoryAtPath: _lockPath
attributes: attributesToSet]; withIntermediateDirectories: YES
attributes: attributesToSet
error: NULL];
if (locked == NO) if (locked == NO)
{ {
BOOL dir; BOOL dir;
@ -206,7 +208,9 @@ static NSFileManager *mgr = nil;
if ([mgr fileExistsAtPath: _lockPath isDirectory: &dir] == NO) if ([mgr fileExistsAtPath: _lockPath isDirectory: &dir] == NO)
{ {
locked = [mgr createDirectoryAtPath: _lockPath locked = [mgr createDirectoryAtPath: _lockPath
attributes: attributesToSet]; withIntermediateDirectories: YES
attributes: attributesToSet
error: NULL];
if (locked == NO) if (locked == NO)
{ {
NSLog(@"Failed to create lock directory '%@' - %@", NSLog(@"Failed to create lock directory '%@' - %@",

View file

@ -126,8 +126,11 @@ static NSHTTPCookieStorage *storage = nil;
fileExistsAtPath: path isDirectory: &isDir] == NO || isDir == NO) fileExistsAtPath: path isDirectory: &isDir] == NO || isDir == NO)
{ {
BOOL ok; BOOL ok;
ok = [[NSFileManager defaultManager] createDirectoryAtPath: path ok = [[NSFileManager defaultManager] createDirectoryAtPath: path
withIntermediateDirectories: YES attributes: nil error: NULL]; withIntermediateDirectories: YES
attributes: nil
error: NULL];
if (ok == NO) if (ok == NO)
return nil; return nil;
} }

View file

@ -1196,11 +1196,15 @@ typedef struct {
path = [path stringByAppendingPathComponent: @"NSMessagePort"]; path = [path stringByAppendingPathComponent: @"NSMessagePort"];
[[NSFileManager defaultManager] createDirectoryAtPath: path [[NSFileManager defaultManager] createDirectoryAtPath: path
attributes: attr]; withIntermediateDirectories: YES
attributes: attr
error: NULL];
path = [path stringByAppendingPathComponent: @"ports"]; path = [path stringByAppendingPathComponent: @"ports"];
[[NSFileManager defaultManager] createDirectoryAtPath: path [[NSFileManager defaultManager] createDirectoryAtPath: path
attributes: attr]; withIntermediateDirectories: YES
attributes: attr
error: NULL];
M_LOCK(messagePortLock); M_LOCK(messagePortLock);
path = [path stringByAppendingPathComponent: path = [path stringByAppendingPathComponent:

View file

@ -278,11 +278,15 @@ static void clean_up_names(void)
path = [path stringByAppendingPathComponent: @"NSMessagePort"]; path = [path stringByAppendingPathComponent: @"NSMessagePort"];
[[NSFileManager defaultManager] createDirectoryAtPath: path [[NSFileManager defaultManager] createDirectoryAtPath: path
attributes: attr]; withIntermediateDirectories: YES
attributes: attr
error: NULL];
path = [path stringByAppendingPathComponent: @"names"]; path = [path stringByAppendingPathComponent: @"names"];
[[NSFileManager defaultManager] createDirectoryAtPath: path [[NSFileManager defaultManager] createDirectoryAtPath: path
attributes: attr]; withIntermediateDirectories: YES
attributes: attr
error: NULL];
base_path = RETAIN(path); base_path = RETAIN(path);
} }

View file

@ -682,7 +682,10 @@ static void ExtractValuesFromConfig(NSDictionary *config)
if ([manager fileExistsAtPath: path isDirectory: &flag] == NO if ([manager fileExistsAtPath: path isDirectory: &flag] == NO
|| flag == NO) || flag == NO)
{ {
[manager createDirectoryAtPath: path attributes: attr]; [manager createDirectoryAtPath: path
withIntermediateDirectories: YES
attributes: attr
error: NULL];
} }
} }
@ -2005,7 +2008,9 @@ NSTemporaryDirectory(void)
attr = [NSDictionary dictionaryWithObject: p attr = [NSDictionary dictionaryWithObject: p
forKey: NSFilePosixPermissions]; forKey: NSFilePosixPermissions];
if ([manager createDirectoryAtPath: tempDirName if ([manager createDirectoryAtPath: tempDirName
attributes: attr] == NO) withIntermediateDirectories: YES
attributes: attr
error: NULL] == NO)
{ {
NSWarnFLog(@"Attempt to create a secure temporary" NSWarnFLog(@"Attempt to create a secure temporary"
@" directory (%@) failed.", tempDirName); @" directory (%@) failed.", tempDirName);

View file

@ -467,8 +467,10 @@ foundIgnorableWhitespace: (NSString *)string
unsigned int *table; unsigned int *table;
} }
+ (void) serializePropertyList: (id)aPropertyList intoData: (NSMutableData *)destination; + (void) serializePropertyList: (id)aPropertyList
- (id) initWithPropertyList: (id)aPropertyList intoData: (NSMutableData *)destination; intoData: (NSMutableData *)destination;
- (id) initWithPropertyList: (id)aPropertyList
intoData: (NSMutableData *)destination;
- (void) generate; - (void) generate;
- (void) storeObject: (id)object; - (void) storeObject: (id)object;
- (void) cleanup; - (void) cleanup;

View file

@ -209,7 +209,10 @@ GSSpellServerName(NSString *vendor, NSString *language)
else else
{ {
// The directory does not exist create it. // The directory does not exist create it.
if ([mgr createDirectoryAtPath: dirPath attributes: nil]) if ([mgr createDirectoryAtPath: dirPath
withIntermediateDirectories: YES
attributes: nil
error: NULL])
{ {
// Directory created. Now create the empty file. // Directory created. Now create the empty file.
NSArray *emptyDict = [NSArray array]; NSArray *emptyDict = [NSArray array];

View file

@ -163,7 +163,10 @@ lockPath(NSString *defaultsDatabase, BOOL verbose)
if ([mgr fileExistsAtPath: path isDirectory: &isDir] == NO) if ([mgr fileExistsAtPath: path isDirectory: &isDir] == NO)
{ {
if ([mgr createDirectoryAtPath: path attributes: attr] == NO) if ([mgr createDirectoryAtPath: path
withIntermediateDirectories: YES
attributes: attr
error: NULL] == NO)
{ {
if (verbose) if (verbose)
NSLog(@"Defaults path '%@' does not exist - failed to create it.", NSLog(@"Defaults path '%@' does not exist - failed to create it.",
@ -186,7 +189,10 @@ lockPath(NSString *defaultsDatabase, BOOL verbose)
path = [path stringByAppendingPathComponent: @".lck"]; path = [path stringByAppendingPathComponent: @".lck"];
if ([mgr fileExistsAtPath: path isDirectory: &isDir] == NO) if ([mgr fileExistsAtPath: path isDirectory: &isDir] == NO)
{ {
if ([mgr createDirectoryAtPath: path attributes: attr] == NO) if ([mgr createDirectoryAtPath: path
withIntermediateDirectories: YES
attributes: attr
error: NULL] == NO)
{ {
if (verbose) if (verbose)
NSLog(@"Defaults path '%@' does not exist - failed to create it.", NSLog(@"Defaults path '%@' does not exist - failed to create it.",

View file

@ -913,7 +913,10 @@ main(int argc, char **argv, char **env)
if ([documentationDirectory length] > 0 if ([documentationDirectory length] > 0
&& [mgr fileExistsAtPath: documentationDirectory] == NO) && [mgr fileExistsAtPath: documentationDirectory] == NO)
{ {
[mgr createDirectoryAtPath: documentationDirectory attributes: nil]; [mgr createDirectoryAtPath: documentationDirectory
withIntermediateDirectories: YES
attributes: nil
error: NULL];
} }
symbolDeclsFile = [documentationDirectory symbolDeclsFile = [documentationDirectory
@ -2359,7 +2362,10 @@ main(int argc, char **argv, char **env)
file = [stamp stringByDeletingLastPathComponent]; file = [stamp stringByDeletingLastPathComponent];
if ([file length]> 0 && [mgr fileExistsAtPath: file] == NO) if ([file length]> 0 && [mgr fileExistsAtPath: file] == NO)
{ {
[mgr createDirectoryAtPath: file attributes: nil]; [mgr createDirectoryAtPath: file
withIntermediateDirectories: YES
attributes: nil
error: NULL];
} }
[depend writeToFile: stamp atomically: YES]; [depend writeToFile: stamp atomically: YES];
} }