Use the documented key for the file path when calling the error handler

This commit is contained in:
Wolfgang Lux 2025-04-15 16:14:24 +02:00
parent 9f8c181ab5
commit ddb68e1b29
2 changed files with 18 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2025-04-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSFileManager.m: Use the documented key for the file path
in the error dictionary passed to the error handler and continue
setting the incorrect one as well for backward compatibility.
2025-04-08 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSOperation.m (_thread): Fix potential deadlock when

View file

@ -3627,8 +3627,14 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
if ([handler respondsToSelector:
@selector (fileManager:shouldProceedAfterError:)])
{
/* wl 20250114: For a very long time, this method incorrectly was
* using NSFilePathErrorKey instead of the documented key @"Path"
* to report the affected path. For backward compatibility we keep
* setting the wrong key below.
*/
NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys:
path, NSFilePathErrorKey,
path, @"Path",
error, @"Error", nil];
return [handler fileManager: self
shouldProceedAfterError: errorInfo];
@ -3645,8 +3651,14 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
if ([handler respondsToSelector:
@selector (fileManager:shouldProceedAfterError:)])
{
/* wl 20250114: For a very long time, this method incorrectly was
* using NSFilePathErrorKey instead of the documented key @"Path"
* to report the affected path. For backward compatibility we keep
* setting the wrong key below.
*/
NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys:
path, NSFilePathErrorKey,
path, @"Path",
fromPath, @"FromPath",
toPath, @"ToPath",
error, @"Error", nil];