Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -310,11 +310,10 @@ createParents: (bool)createParents { void *pool = objc_autoreleasePoolPush(); OFMutableURL *URL = [[URL_ mutableCopy] autorelease]; OFArray OF_GENERIC(OFString *) *components; - OFString *currentPath = nil; if (URL == nil) @throw [OFInvalidArgumentException exception]; if (!createParents) { @@ -342,22 +341,17 @@ */ if (e.errNo != ENOENT) @throw e; } - components = [URL.URLEncodedPath componentsSeparatedByString: @"/"]; + components = [[URL.pathComponents retain] autorelease]; + URL.URLEncodedPath = @"/"; for (OFString *component in components) { - if (currentPath != nil) - currentPath = [currentPath - stringByAppendingFormat: @"/%@", component]; - else - currentPath = component; - - URL.URLEncodedPath = currentPath; - - if (currentPath.length > 0 && + [URL appendPathComponent: component]; + + if (![URL.URLEncodedPath isEqual: @"/"] && ![self directoryExistsAtURL: URL]) [self createDirectoryAtURL: URL]; } objc_autoreleasePoolPop(pool);