Title: [277498] trunk/Source
Revision
277498
Author
[email protected]
Date
2021-05-14 10:54:23 -0700 (Fri, 14 May 2021)

Log Message

Drop unused FileSystem::homeDirectoryPath()
https://bugs.webkit.org/show_bug.cgi?id=225808

Reviewed by Anders Carlsson.

Source/WebKitLegacy/win:

Fix Window-specific code that was calling FileSystem::homeDirectoryPath(),
which would always return the empty string on Windows. Call
FileSystem::roamingUserSpecificStorageDirectory() since it returns the
%AppData% folder and this is what the code actually wants.

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::defaultPluginDirectories):
(WebCore::PluginDatabase::isPreferredPluginDirectory):

Source/WTF:

Only Windows-specific code was calling FileSystem::homeDirectoryPath() but the Windows implementation
for this was always returning the empty string.

* wtf/FileSystem.h:
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (277497 => 277498)


--- trunk/Source/WTF/ChangeLog	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WTF/ChangeLog	2021-05-14 17:54:23 UTC (rev 277498)
@@ -1,5 +1,23 @@
 2021-05-14  Chris Dumez  <[email protected]>
 
+        Drop unused FileSystem::homeDirectoryPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225808
+
+        Reviewed by Anders Carlsson.
+
+        Only Windows-specific code was calling FileSystem::homeDirectoryPath() but the Windows implementation
+        for this was always returning the empty string.
+
+        * wtf/FileSystem.h:
+        * wtf/cocoa/FileSystemCocoa.mm:
+        (WTF::FileSystemImpl::homeDirectoryPath): Deleted.
+        * wtf/glib/FileSystemGlib.cpp:
+        (WTF::FileSystemImpl::homeDirectoryPath): Deleted.
+        * wtf/win/FileSystemWin.cpp:
+        (WTF::FileSystemImpl::homeDirectoryPath): Deleted.
+
+2021-05-14  Chris Dumez  <[email protected]>
+
         Rename FileSystem::getFileSize() to FileSystem::fileSize()
         https://bugs.webkit.org/show_bug.cgi?id=225798
 

Modified: trunk/Source/WTF/wtf/FileSystem.h (277497 => 277498)


--- trunk/Source/WTF/wtf/FileSystem.h	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WTF/wtf/FileSystem.h	2021-05-14 17:54:23 UTC (rev 277498)
@@ -123,7 +123,6 @@
 WTF_EXPORT_PRIVATE String pathByAppendingComponents(StringView path, const Vector<StringView>& components);
 WTF_EXPORT_PRIVATE String lastComponentOfPathIgnoringTrailingSlash(const String& path);
 WTF_EXPORT_PRIVATE bool makeAllDirectories(const String& path);
-WTF_EXPORT_PRIVATE String homeDirectoryPath();
 WTF_EXPORT_PRIVATE String pathFileName(const String&);
 WTF_EXPORT_PRIVATE String parentPath(const String&);
 WTF_EXPORT_PRIVATE bool getVolumeFreeSpace(const String&, uint64_t&);

Modified: trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm (277497 => 277498)


--- trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm	2021-05-14 17:54:23 UTC (rev 277498)
@@ -88,11 +88,6 @@
     return temporaryFile;
 }
 
-String homeDirectoryPath()
-{
-    return NSHomeDirectory();
-}
-
 String openTemporaryFile(const String& prefix, PlatformFileHandle& platformFileHandle, const String& suffix)
 {
     platformFileHandle = invalidPlatformFileHandle;

Modified: trunk/Source/WTF/wtf/glib/FileSystemGlib.cpp (277497 => 277498)


--- trunk/Source/WTF/wtf/glib/FileSystemGlib.cpp	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WTF/wtf/glib/FileSystemGlib.cpp	2021-05-14 17:54:23 UTC (rev 277498)
@@ -135,11 +135,6 @@
     return WTF::nullopt;
 }
 
-String homeDirectoryPath()
-{
-    return stringFromFileSystemRepresentation(g_get_home_dir());
-}
-
 String openTemporaryFile(const String& prefix, PlatformFileHandle& handle, const String& suffix)
 {
     // FIXME: Suffix is not supported, but OK for now since the code using it is macOS-port-only.

Modified: trunk/Source/WTF/wtf/win/FileSystemWin.cpp (277497 => 277498)


--- trunk/Source/WTF/wtf/win/FileSystemWin.cpp	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WTF/wtf/win/FileSystemWin.cpp	2021-05-14 17:54:23 UTC (rev 277498)
@@ -159,11 +159,6 @@
 
 #endif // !USE(CF)
 
-String homeDirectoryPath()
-{
-    return "";
-}
-
 static String bundleName()
 {
     static const NeverDestroyed<String> name = [] {

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (277497 => 277498)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-05-14 17:54:23 UTC (rev 277498)
@@ -1,5 +1,21 @@
 2021-05-14  Chris Dumez  <[email protected]>
 
+        Drop unused FileSystem::homeDirectoryPath()
+        https://bugs.webkit.org/show_bug.cgi?id=225808
+
+        Reviewed by Anders Carlsson.
+
+        Fix Window-specific code that was calling FileSystem::homeDirectoryPath(),
+        which would always return the empty string on Windows. Call
+        FileSystem::roamingUserSpecificStorageDirectory() since it returns the
+        %AppData% folder and this is what the code actually wants.
+
+        * Plugins/PluginDatabase.cpp:
+        (WebCore::PluginDatabase::defaultPluginDirectories):
+        (WebCore::PluginDatabase::isPreferredPluginDirectory):
+
+2021-05-14  Chris Dumez  <[email protected]>
+
         Rename FileSystem::pathGetFileName() to FileSystem::pathFileName()
         https://bugs.webkit.org/show_bug.cgi?id=225806
 

Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (277497 => 277498)


--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2021-05-14 17:28:32 UTC (rev 277497)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp	2021-05-14 17:54:23 UTC (rev 277498)
@@ -379,9 +379,8 @@
 {
     Vector<String> paths;
 
-    String userPluginPath = FileSystem::homeDirectoryPath();
-    userPluginPath.append(String("\\Application Data\\Mozilla\\plugins"));
-    paths.append(userPluginPath);
+    // Default plugin directory is: %AppData%\Mozilla\plugins.
+    paths.append(FileSystem::pathByAppendingComponents(FileSystem::roamingUserSpecificStorageDirectory(), { "Mozilla", "plugins" }));
 
     return paths;
 }
@@ -388,10 +387,8 @@
 
 bool PluginDatabase::isPreferredPluginDirectory(const String& path)
 {
-    String preferredPath = FileSystem::homeDirectoryPath();
+    String preferredPath = FileSystem::pathByAppendingComponents(FileSystem::roamingUserSpecificStorageDirectory(), { "Mozilla", "plugins" });
 
-    preferredPath.append(String("\\Application Data\\Mozilla\\plugins"));
-
     // TODO: We should normalize the path before doing a comparison.
     return path == preferredPath;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to