mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Try to ensure basic directories exist
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21873 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bf7f08056d
commit
97ce2e5e03
2 changed files with 39 additions and 4 deletions
|
@ -317,6 +317,38 @@ static void ExtractValuesFromConfig(NSDictionary *config)
|
|||
ASSIGN(gnustepUserRoot,
|
||||
[gnustepUserHome stringByAppendingPathComponent: gnustepUserDir]);
|
||||
|
||||
/*
|
||||
* Try to ensure that essential user directories exist.
|
||||
* FIXME ... Check/creation should perhaps be configurable.
|
||||
*/
|
||||
if (1)
|
||||
{
|
||||
NSFileManager *manager;
|
||||
NSString *path;
|
||||
NSDictionary *attr;
|
||||
BOOL flag;
|
||||
|
||||
manager = [NSFileManager defaultManager];
|
||||
attr = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: 0750]
|
||||
forKey: NSFilePosixPermissions];
|
||||
|
||||
// make sure user root exists.
|
||||
path = gnustepUserRoot;
|
||||
if ([manager fileExistsAtPath: path isDirectory: &flag] == NO
|
||||
|| flag == NO)
|
||||
{
|
||||
[manager createDirectoryAtPath: path attributes: attr];
|
||||
}
|
||||
|
||||
// make sure library directory exists (to store resources).
|
||||
path = [path stringByAppendingPathComponent: @"Library"];
|
||||
if ([manager fileExistsAtPath: path isDirectory: &flag] == NO
|
||||
|| flag == NO)
|
||||
{
|
||||
[manager createDirectoryAtPath: path attributes: attr];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally set default locations for the essential paths if required.
|
||||
*/
|
||||
|
@ -1797,10 +1829,6 @@ if (domainMask & mask) \
|
|||
i--;
|
||||
count--;
|
||||
}
|
||||
/*
|
||||
* this may look like a performance hit at first glance, but if these
|
||||
* string methods don't alter the string, they return the receiver
|
||||
*/
|
||||
else if (expandTilde == YES)
|
||||
{
|
||||
[paths replaceObjectAtIndex: i
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue