diff --git a/ChangeLog b/ChangeLog index 36cdaf74a..810a8a15e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2024-23-09: Hugo Melder +2024-10-13 Richard Frith-Macdonald + + * Source/NSFileManager.m: Create an NSError object when we fail to + copy because the destination item already exists. + +2024-09-23: Hugo Melder * Headers/Foundation/NSThread.h: * Source/NSString.m: @@ -6,14 +11,14 @@ Cache ICU collator in thread-local storage to avoid expensive construction when comparing strings. -2024-13-08: Hugo Melder +2024-08-13: Hugo Melder * Source/NSOperation.m: * Headers/Foundation/NSOperation.h: Give NSOperationQueue worker threads a proper thread name for easy identification. -2024-12-08 Hugo Melder +2024-08-12 Hugo Melder * Source/NSThread.m: Fix threadPriority and setThreadPriority: on Android. diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index 02feb425a..7d83999c7 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -1338,11 +1338,13 @@ - (BOOL) copyPath: (NSString*)source if ([self fileExistsAtPath: destination] == YES) { + [self _setLastError: @"Could not copy - destination already exists"]; return NO; } attrs = [self fileAttributesAtPath: source traverseLink: NO]; if (attrs == nil) { + [self _setLastError: @"Cound not copy - destination is not readable"]; return NO; } fileType = [attrs fileType]; @@ -1368,7 +1370,8 @@ - (BOOL) copyPath: (NSString*)source if ([[destination stringByAppendingString: @"/"] hasPrefix: [source stringByAppendingString: @"/"]]) { - [self _setLastError: @"Could not copy - destination is a descendant of source"]; + [self _setLastError: + @"Could not copy - destination is a descendant of source"]; return NO; }