RESOLVED FIXED 143968
moveFile should overwrite existing files
https://bugs.webkit.org/show_bug.cgi?id=143968
Summary moveFile should overwrite existing files
Alex Christensen
Reported 2015-04-20 15:12:16 PDT
When compiling content extensions, the call to moveFile fails often because the file already exists.
Attachments
Patch (2.26 KB, patch)
2015-04-20 15:28 PDT, Alex Christensen
no flags
Patch (2.41 KB, patch)
2015-04-20 16:23 PDT, Alex Christensen
andersca: review+
Alex Christensen
Comment 1 2015-04-20 15:28:39 PDT
Brady Eidson
Comment 2 2015-04-20 16:01:14 PDT
Comment on attachment 251193 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251193&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:44 > +@implementation WebFileManagerDelegate > +- (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error movingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL Add an empty line here please.
Anders Carlsson
Comment 3 2015-04-20 16:05:51 PDT
Comment on attachment 251193 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251193&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:90 > + RetainPtr<WebFileManagerDelegate> delegate = adoptNS([[WebFileManagerDelegate alloc] init]); > + [[NSFileManager defaultManager] setDelegate:delegate.get()]; Don't set a custom delegate on the default manager, just create a new manager instead.
Alex Christensen
Comment 4 2015-04-20 16:23:34 PDT
Anders Carlsson
Comment 5 2015-04-20 16:25:18 PDT
Comment on attachment 251201 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251201&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:50 > + return [error code] == NSFileWriteFileExistsError; Dot syntax. > Source/WebCore/platform/mac/FileSystemMac.mm:91 > + RetainPtr<NSFileManager> manager = adoptNS([[NSFileManager alloc] init]); > + RetainPtr<WebFileManagerDelegate> delegate = adoptNS([[WebFileManagerDelegate alloc] init]); Just use auto here. > Source/WebCore/platform/mac/FileSystemMac.mm:92 > + [manager.get() setDelegate:delegate.get()]; No need for .get() in manager.get(). > Source/WebCore/platform/mac/FileSystemMac.mm:94 > + return [manager.get() moveItemAtURL:[NSURL fileURLWithPath:oldPath] toURL:[NSURL fileURLWithPath:newPath] error:nil]; Same thing here.
Alex Christensen
Comment 6 2015-04-20 16:40:22 PDT
Note You need to log in before you can comment on or make changes to this bug.