Title: [201796] trunk/Source/WebCore
- Revision
- 201796
- Author
- carlo...@webkit.org
- Date
- 2016-06-07 23:51:51 -0700 (Tue, 07 Jun 2016)
Log Message
[GLIB] Implement hardLinkOrCopyFile() in FileSystemGlib
https://bugs.webkit.org/show_bug.cgi?id=158473
Reviewed by Michael Catanzaro.
It was added in r199230 to be used by IndexedDB blob support, but never implemented for GLib.
* platform/glib/FileSystemGlib.cpp:
(WebCore::hardLinkOrCopyFile):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (201795 => 201796)
--- trunk/Source/WebCore/ChangeLog 2016-06-08 06:49:36 UTC (rev 201795)
+++ trunk/Source/WebCore/ChangeLog 2016-06-08 06:51:51 UTC (rev 201796)
@@ -1,3 +1,15 @@
+2016-06-07 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GLIB] Implement hardLinkOrCopyFile() in FileSystemGlib
+ https://bugs.webkit.org/show_bug.cgi?id=158473
+
+ Reviewed by Michael Catanzaro.
+
+ It was added in r199230 to be used by IndexedDB blob support, but never implemented for GLib.
+
+ * platform/glib/FileSystemGlib.cpp:
+ (WebCore::hardLinkOrCopyFile):
+
2016-06-07 Adam Bergkvist <adam.bergkv...@ericsson.com>
WebRTC: Refactor: Use captures with initializers in MediaEndpointPeerConnection::createOffer()
Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (201795 => 201796)
--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp 2016-06-08 06:49:36 UTC (rev 201795)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp 2016-06-08 06:51:51 UTC (rev 201796)
@@ -372,10 +372,27 @@
#endif
}
-bool hardLinkOrCopyFile(const String&, const String&)
+bool hardLinkOrCopyFile(const String& source, const String& destination)
{
- // FIXME: Implement
- return false;
+#if OS(WINDOWS)
+ return !!::CopyFile(source.charactersWithNullTermination().data(), destination.charactersWithNullTermination().data(), TRUE);
+#else
+ GUniquePtr<gchar> sourceFilename = unescapedFilename(source);
+ if (!sourceFilename)
+ return false;
+
+ GUniquePtr<gchar> destinationFilename = unescapedFilename(destination);
+ if (!destinationFilename)
+ return false;
+
+ if (!link(sourceFilename.get(), destinationFilename.get()))
+ return true;
+
+ // Hard link failed. Perform a copy instead.
+ GRefPtr<GFile> sourceFile = adoptGRef(g_file_new_for_path(sourceFilename.get()));
+ GRefPtr<GFile> destinationFile = adoptGRef(g_file_new_for_path(destinationFilename.get()));
+ return g_file_copy(sourceFile.get(), destinationFile.get(), G_FILE_COPY_NONE, nullptr, nullptr, nullptr, nullptr);
+#endif
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes