Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -177,10 +177,13 @@ group: (OFString*)group; #endif /*! * @brief Copies a file, directory or symlink (if supported by the OS). + * + * The destination path must be a full path, which means it must include the + * name of the item. * * If an item already exists, the copy operation fails. This is also the case * if a directory is copied and an item already exists in the destination * directory. * @@ -190,10 +193,13 @@ + (void)copyItemAtPath: (OFString*)source toPath: (OFString*)destination; /*! * @brief Renames an item. + * + * The destination path must be a full path, which means it must include the + * name of the item. * * @param source The item to rename * @param destination The new name for the item */ + (void)renameItemAtPath: (OFString*)source Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -543,16 +543,10 @@ if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); - if ([self directoryExistsAtPath: destination]) { - OFArray *components = [OFArray arrayWithObjects: - destination, [source lastPathComponent], nil]; - destination = [OFString pathWithComponents: components]; - } - #ifndef _WIN32 if (lstat([destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == 0) { #else if (_wstat([destination UTF16String], &s) == 0) { @@ -679,16 +673,10 @@ if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); - if ([self directoryExistsAtPath: destination]) { - OFArray *components = [OFArray arrayWithObjects: - destination, [source lastPathComponent], nil]; - destination = [OFString pathWithComponents: components]; - } - #ifndef _WIN32 if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wrename([source UTF16String], [destination UTF16String]))