Skip to content

Commit

Permalink
Improve errors for copying.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Oct 13, 2024
1 parent 68964f1 commit 1cb846e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
2024-23-09: Hugo Melder <[email protected]>
2024-10-13 Richard Frith-Macdonald <[email protected]>

* Source/NSFileManager.m: Create an NSError object when we fail to
copy because the destination item already exists.

2024-09-23: Hugo Melder <[email protected]>

* Headers/Foundation/NSThread.h:
* Source/NSString.m:
* Source/NSThread.m:
Cache ICU collator in thread-local storage to avoid
expensive construction when comparing strings.

2024-13-08: Hugo Melder <[email protected]>
2024-08-13: Hugo Melder <[email protected]>

* Source/NSOperation.m:
* Headers/Foundation/NSOperation.h:
Give NSOperationQueue worker threads a proper thread
name for easy identification.

2024-12-08 Hugo Melder <[email protected]>
2024-08-12 Hugo Melder <[email protected]>
* Source/NSThread.m:
Fix threadPriority and setThreadPriority: on Android.

Expand Down
5 changes: 4 additions & 1 deletion Source/NSFileManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
}

Expand Down

0 comments on commit 1cb846e

Please sign in to comment.