Title: [239043] trunk/Source/WebCore
Revision
239043
Author
[email protected]
Date
2018-12-10 12:46:29 -0800 (Mon, 10 Dec 2018)

Log Message

[GLib] FileSystem::moveFile() should fall back to copying
https://bugs.webkit.org/show_bug.cgi?id=192562

Reviewed by Michael Catanzaro.

No new tests needed.

* platform/glib/FileSystemGlib.cpp:
(WebCore::FileSystem::moveFile): Use g_file_move() instead of a plain g_rename(), which
provides a fall-back which does copy+delete when a direct move or rename cannot be done.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239042 => 239043)


--- trunk/Source/WebCore/ChangeLog	2018-12-10 20:43:40 UTC (rev 239042)
+++ trunk/Source/WebCore/ChangeLog	2018-12-10 20:46:29 UTC (rev 239043)
@@ -1,3 +1,16 @@
+2018-12-10  Adrian Perez de Castro  <[email protected]>
+
+        [GLib] FileSystem::moveFile() should fall back to copying
+        https://bugs.webkit.org/show_bug.cgi?id=192562
+
+        Reviewed by Michael Catanzaro.
+
+        No new tests needed.
+
+        * platform/glib/FileSystemGlib.cpp:
+        (WebCore::FileSystem::moveFile): Use g_file_move() instead of a plain g_rename(), which
+        provides a fall-back which does copy+delete when a direct move or rename cannot be done.
+
 2018-12-10  Simon Fraser  <[email protected]>
 
         Allow control over child order when adding nodes to the scrolling tree

Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (239042 => 239043)


--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2018-12-10 20:43:40 UTC (rev 239042)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2018-12-10 20:46:29 UTC (rev 239043)
@@ -400,7 +400,10 @@
     if (!newFilename)
         return false;
 
-    return g_rename(oldFilename.get(), newFilename.get()) != -1;
+    GRefPtr<GFile> oldFile = adoptGRef(g_file_new_for_path(oldFilename.get()));
+    GRefPtr<GFile> newFile = adoptGRef(g_file_new_for_path(newFilename.get()));
+
+    return g_file_move(oldFile.get(), newFile.get(), G_FILE_COPY_OVERWRITE, nullptr, nullptr, nullptr, nullptr);
 }
 
 bool hardLinkOrCopyFile(const String& source, const String& destination)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to