Minor tweaks.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24919 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-03-22 15:07:54 +00:00
parent 5baa6a67c5
commit 051f24a8b3
3 changed files with 26 additions and 23 deletions

View file

@ -1,3 +1,10 @@
2007-03-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m: NSTemporaryDirectory() don't raise
exception on error, just log a warning and return nil.
* Source/NSDateFormatter.m: When given an empty string to convert to
a date, just skip the conversion.
2007-03-21 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSBundle.m ([+initialize]): Removed unused check.

View file

@ -82,7 +82,14 @@
{
NSCalendarDate *d;
d = [NSCalendarDate dateWithString: string calendarFormat: _dateFormat];
if ([string length] == 0)
{
d = nil;
}
else
{
d = [NSCalendarDate dateWithString: string calendarFormat: _dateFormat];
}
if (d == nil)
{
if (_allowsNaturalLanguage)

View file

@ -1502,10 +1502,8 @@ NSTemporaryDirectory(void)
if ([manager fileExistsAtPath: tempDirName isDirectory: &flag] == NO
|| flag == NO)
{
[NSException raise: NSGenericException
format: @"Temporary directory (%@) does not exist",
tempDirName];
return nil; /* Not reached. */
NSWarnFLog(@"Temporary directory (%@) does not exist", tempDirName);
return nil;
}
/*
@ -1544,10 +1542,7 @@ NSTemporaryDirectory(void)
secure = [NSString stringWithFormat: @"GNUstepSecure%d", uid];
tempDirName
= [baseTempDirName stringByAppendingPathComponent: secure];
/*
NSLog(@"Temporary directory (%@) may be insecure ... attempting to "
@"add secure subdirectory", tempDirName);
*/
if ([manager fileExistsAtPath: tempDirName] == NO)
{
NSNumber *p = [NSNumber numberWithInt: 0700];
@ -1557,11 +1552,9 @@ NSTemporaryDirectory(void)
if ([manager createDirectoryAtPath: tempDirName
attributes: attr] == NO)
{
[NSException raise: NSGenericException
format:
@"Attempt to create a secure temporary directory (%@) failed.",
tempDirName];
return nil; /* Not reached. */
NSWarnFLog(@"Attempt to create a secure temporary"
@" directory (%@) failed.", tempDirName);
return nil;
}
}
@ -1574,21 +1567,17 @@ NSTemporaryDirectory(void)
perm = perm & 0777;
if ((perm != 0700 && perm != 0600) || owner != uid)
{
[NSException raise: NSGenericException
format:
@"Attempt to create a secure temporary directory (%@) failed.",
tempDirName];
return nil; /* Not reached. */
NSWarnFLog(@"Attempt to create a secure temporary"
@" directory (%@) failed.", tempDirName);
return nil;
}
}
#endif
if ([manager isWritableFileAtPath: tempDirName] == NO)
{
[NSException raise: NSGenericException
format: @"Temporary directory (%@) is not writable",
tempDirName];
return nil; /* Not reached. */
NSWarnFLog(@"Temporary directory (%@) is not writable", tempDirName);
return nil;
}
return tempDirName;
}