diff --git a/ChangeLog b/ChangeLog index acac637ca..8e48ea21e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-11-03 Richard Frith-Macdonald + + * Source/NSFileManager.m: Fix case where positive result of asking + handler whether to proceed was ignored. + 2024-11-01 Richard Frith-Macdonald * Source/NSDate.m: Fix returing receiver when earlier/later argument diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index ebba409d8..ee1772b7c 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -1386,11 +1386,30 @@ static gs_mutex_t classLock = GS_MUTEX_INIT_STATIC; if ([self createDirectoryAtPath: destination attributes: attrs] == NO) { - return [self _proceedAccordingToHandler: handler - forError: [self _lastError] - inPath: destination - fromPath: source - toPath: destination]; + if (NO == [self _proceedAccordingToHandler: handler + forError: [self _lastError] + inPath: destination + fromPath: source + toPath: destination]) + { + return NO; + } + else + { + BOOL dirOK; + + /* We may have managed to create the directory but not set + * its attributes ... if so we can continue copying. + */ + if (![self fileExistsAtPath: destination isDirectory: &dirOK]) + { + dirOK = NO; + } + if (!dirOK) + { + return NO; + } + } } if ([self _copyPath: source toPath: destination handler: handler] == NO) @@ -3419,8 +3438,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X) result = NO; break; } - /* - * We may have managed to create the directory but not set + /* We may have managed to create the directory but not set * its attributes ... if so we can continue copying. */ if (![self fileExistsAtPath: destinationFile isDirectory: &dirOK])