mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Tidy path checks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14325 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5bf285fe10
commit
fc084b0fdb
1 changed files with 10 additions and 5 deletions
|
@ -559,18 +559,23 @@ static void unescape(const char *from, char * to)
|
|||
/**
|
||||
* Initialise as a file URL with the specified path (which must
|
||||
* be a valid path on the local filesystem).<br />
|
||||
* Converts relative paths to absolute ones.<br />
|
||||
* Appends a trailing slash to the path when necessary if it
|
||||
* specifies a directory.<br />
|
||||
* Calls -initWithScheme:host:path:
|
||||
*/
|
||||
- (id) initFileURLWithPath: (NSString*)aPath
|
||||
{
|
||||
if ([aPath hasSuffix: @"/"] == NO)
|
||||
{
|
||||
BOOL flag = NO;
|
||||
BOOL flag = NO;
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: aPath
|
||||
isDirectory: &flag] == YES && flag == YES)
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: aPath
|
||||
isDirectory: &flag] == YES)
|
||||
{
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [aPath stringByStandardizingPath];
|
||||
}
|
||||
if (flag == YES && [aPath hasSuffix: @"/"] == NO)
|
||||
{
|
||||
aPath = [aPath stringByAppendingString: @"/"];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue