Improve errors for copying.

This commit is contained in:
rfm 2024-10-13 13:54:53 +01:00
parent 68964f188e
commit 1cb846e607
2 changed files with 12 additions and 4 deletions

View file

@ -1,4 +1,9 @@
2024-23-09: Hugo Melder <hugo@algoriddim.com>
2024-10-13 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Create an NSError object when we fail to
copy because the destination item already exists.
2024-09-23: Hugo Melder <hugo@algoriddim.com>
* 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 <hugo@algoriddim.com>
2024-08-13: Hugo Melder <hugo@algoriddim.com>
* Source/NSOperation.m:
* Headers/Foundation/NSOperation.h:
Give NSOperationQueue worker threads a proper thread
name for easy identification.
2024-12-08 Hugo Melder <hugo@algoriddim.com>
2024-08-12 Hugo Melder <hugo@algoriddim.com>
* Source/NSThread.m:
Fix threadPriority and setThreadPriority: on Android.

View file

@ -1338,11 +1338,13 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
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 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC;
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;
}