Commit 69012bc6 authored by mjs's avatar mjs

WebFoundation:

        Reviewed by Darin, Dave and Trey, and given the seal of approval by Don.

	Added a new NSFileManager extension method which can be used to
	remove a file but will refuse to remove a directory. Used it
	wherever we remove files but not directories.

        * Misc.subproj/WebNSFileManagerExtras.h:
        * Misc.subproj/WebNSFileManagerExtras.m:
	(-[NSFileManager _web_removeFileOnlyAtPath:]): New method that
	removes a file using unlink(2), which means we can't possibly remove a directory.
	Also unlink ._ file if we are on a filesystem that doesn't support a resource fork.
        * Database.subproj/WebFileDatabase.m:
        (-[WebFileDatabase _truncateToSizeLimit:]):  Use the new method.
        (-[WebFileDatabase performRemoveObjectForKey:]): Use the new method.

WebKit:

        Reviewed by Darin, Dave and Trey, and given the seal of approval by Don.

	Use new safer file removal call that does not handle directories.

        * Downloads.subproj/WebDownloadHandler.m:
	(-[WebDownloadHandler cleanUpAfterFailure]): Use
	_web_removeFileOnlyAtPath:
        * Plugins.subproj/WebBaseNetscapePluginStream.m:
        (-[WebBaseNetscapePluginStream dealloc]): Use _web_removeFileOnlyAtPath:
        (-[WebBaseNetscapePluginStream finishedLoadingWithData:]): Use _web_removeFileOnlyAtPath:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a15075e3
2003-01-13 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin, Dave and Trey, and given the seal of approval by Don.
Use new safer file removal call that does not handle directories.
* Downloads.subproj/WebDownloadHandler.m:
(-[WebDownloadHandler cleanUpAfterFailure]): Use
_web_removeFileOnlyAtPath:
* Plugins.subproj/WebBaseNetscapePluginStream.m:
(-[WebBaseNetscapePluginStream dealloc]): Use _web_removeFileOnlyAtPath:
(-[WebBaseNetscapePluginStream finishedLoadingWithData:]): Use _web_removeFileOnlyAtPath:
2003-01-14 Darin Adler <darin@apple.com>
Reviewed by Dave.
......
......@@ -144,7 +144,7 @@ - (void)cleanUpAfterFailure
BOOL isDirectory;
BOOL fileExists = [fileMgr fileExistsAtPath:path isDirectory:&isDirectory];
if (fileExists && !isDirectory) {
[fileMgr removeFileAtPath:path handler:nil];
[fileMgr _web_removeFileOnlyAtPath:path];
[[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:path];
} else if (!fileExists) {
ERROR("Download file disappeared in the middle of download");
......
......@@ -144,7 +144,7 @@ - (void)cleanUpAfterFailure
BOOL isDirectory;
BOOL fileExists = [fileMgr fileExistsAtPath:path isDirectory:&isDirectory];
if (fileExists && !isDirectory) {
[fileMgr removeFileAtPath:path handler:nil];
[fileMgr _web_removeFileOnlyAtPath:path];
[[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:path];
} else if (!fileExists) {
ERROR("Download file disappeared in the middle of download");
......
......@@ -215,7 +215,7 @@ -(void)_truncateToSizeLimit:(unsigned)size
break;
}
NSString *filePath = [[NSString alloc] initWithFormat:@"%@/%s", path, uniqueKey];
[defaultManager removeFileAtPath:filePath handler:nil];
[defaultManager _web_removeFileOnlyAtPath:filePath];
WebLRUFileListRemoveOldestFileFromList(lru);
}
[mutex unlock];
......@@ -501,7 +501,7 @@ -(void)performRemoveObjectForKey:(id)key
UniqueFilePathForKey(key, uniqueKey);
filePath = [[NSString alloc] initWithFormat:@"%@/%s", path, uniqueKey];
[[NSFileManager defaultManager] removeFileAtPath:filePath handler:nil];
[[NSFileManager defaultManager] _web_removeFileOnlyAtPath:filePath];
WebLRUFileListRemoveFileWithPath(lru, uniqueKey);
[filePath release];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment