[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] NSFileManager informal handler protocol
From: |
Willem Rein Oudshoorn |
Subject: |
[PATCH] NSFileManager informal handler protocol |
Date: |
11 Feb 2003 00:35:50 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
This fixes a few minor problems of how NSFileManager uses
the handler.
In the PATCH
------------
A - According to the documentation, and actual behaviour
under OpenStep, the handler is not obliged to
implement the methods
-fileManager:shouldProceedAfterError:
-fileManager:willProcessPath:
If it does not implement these methods they
are treated as if they return NO.
GNUstep however throws an exception because
it cannot find the method.
B - In the method -_copyFile:toFile:handler:
there is a filehandle leak in case an error
occurs and ther is no handler present.
C - I implemented a little GNUstep extension.
The error dictionary contains, according to
the documentation at most 3 keys:
Error --> string describing the error,
Path --> the path related to the error.
ToPath --> [Optional] the destination path.
I propose to add one other key,
FromPath --> [Optional] the source path.
See the changed documentation in NSFileManager for
details.
Not in the Patch or in other words, Questions.
----------------------------------------------
At the moment -willProcessPath is not always called.
For example if very early in the
-copyPath:toPath:handler: method an error occurs
it will not call the -willProcessPath method.
Also, -shouldProceedAfterError is not called either.
I think this classifies as a bug. But I am
at the moment to tired to think about this.
PATCH
-----------------------------------------------
ChangeLog
---------
2003-02-11 Willem Rein Oudshoorn <woudshoo@xs4all.nl>
* Headers/Foundation/NSFileManager.h: Added a little bit to the
documentation
of the NSFileManagerHandler protocol.
* Source/NSFileManager.m ([NSFileManager -copyPath:toPath:handler:]):
use new private methods to cope with handlers that do not implement
the informal protocol. Pass more information to the handler in case of
an
error.
([NSFileManager -removeFileAtPath:handler:]): see above
([NSFileManager -movePath:toPath:handler:]): see above
([NSFileManager -_copyPath:toPath:handler:]): see above
([NSFileManager -_copyFile:toFile:handler:]): see above, also fixed
leaking
of file descriptors in case of error without a handler.
([NSFileManager -_sendToHandler:handlerwillProcessPath:path]): new
method
([NSFileManager
-_proceedAccordingToHandler:handlerforError:errorinPath:path]): new method
([NSFileManager
-_proceedAccordingToHandler:handlerforError:errorinPath:pathfromPath:fromPathtoPath:toPath]):
new method
Patch
-----
NSFileManager-patch.bz2
Description: NSFileManager.[m|h] patch
- [PATCH] NSFileManager informal handler protocol,
Willem Rein Oudshoorn <=