Title: [274769] trunk
Revision
274769
Author
[email protected]
Date
2021-03-22 12:00:44 -0700 (Mon, 22 Mar 2021)

Log Message

AppleWin can't start due to "Failed to determine path to AAS directory." because iTunes changed the registry key
https://bugs.webkit.org/show_bug.cgi?id=219015

Patch by Tyler Wilcock <[email protected]> on 2021-03-22
Reviewed by Alex Christensen.

It appears that iTunes no longer sets the Apple Application Support
Source/_javascript_Core:

registry entry.  Fall back to trying to find the iTunes installation
directory if the AAS directory is not present.

* shell/DLLLauncherMain.cpp:
(iTunesDirectory): Added.
(modifyPath):

Tools:

registry entry.  Fallback to trying to find the iTunes installation
directory if the AAS directory is not present.

* win/DLLLauncher/DLLLauncherMain.cpp:
(iTunesDirectory): Added.
(modifyPath):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (274768 => 274769)


--- trunk/Source/_javascript_Core/ChangeLog	2021-03-22 19:00:23 UTC (rev 274768)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-03-22 19:00:44 UTC (rev 274769)
@@ -1,3 +1,18 @@
+2021-03-22  Tyler Wilcock  <[email protected]>
+
+        AppleWin can't start due to "Failed to determine path to AAS directory." because iTunes changed the registry key
+        https://bugs.webkit.org/show_bug.cgi?id=219015
+
+        Reviewed by Alex Christensen.
+
+        It appears that iTunes no longer sets the Apple Application Support
+        registry entry.  Fall back to trying to find the iTunes installation
+        directory if the AAS directory is not present.
+
+        * shell/DLLLauncherMain.cpp:
+        (iTunesDirectory): Added.
+        (modifyPath):
+
 2021-03-19  Darin Adler  <[email protected]>
 
         [Cocoa] Make it possible to release a WKWebView on a non-main thread without a crash due to WKScriptMessage race

Modified: trunk/Source/_javascript_Core/shell/DLLLauncherMain.cpp (274768 => 274769)


--- trunk/Source/_javascript_Core/shell/DLLLauncherMain.cpp	2021-03-22 19:00:23 UTC (rev 274768)
+++ trunk/Source/_javascript_Core/shell/DLLLauncherMain.cpp	2021-03-22 19:00:44 UTC (rev 274769)
@@ -82,6 +82,11 @@
     return applePathFromRegistry(L"SOFTWARE\\Apple Inc.\\Apple Application Support", L"InstallDir");
 }
 
+static std::wstring iTunesDirectory()
+{
+    return applePathFromRegistry(L"SOFTWARE\\Apple Computer, Inc.\\iTunes\\", L"InstallDir");
+}
+
 static bool prependPath(const std::wstring& directoryToPrepend)
 {
     std::wstring pathVariable = L"PATH";
@@ -128,18 +133,23 @@
     return true;
 
 #else
+    auto modifyPathWith = [&] (const std::wstring& pathPrefix) {
+        if (!prependPath(pathPrefix)) {
+            fatalError(programName, L"Failed to modify PATH environment variable.");
+            return false;
+        }
+        return true;
+    };
 
-    const std::wstring& pathPrefix = appleApplicationSupportDirectory();
+    const std::wstring& applicationSupportPathPrefix = appleApplicationSupportDirectory();
+    if (directoryExists(applicationSupportPathPrefix))
+        return modifyPathWith(applicationSupportPathPrefix);
 
-    if (!directoryExists(pathPrefix)) {
-        fatalError(programName, L"Failed to determine path to AAS directory.");
-        return false;
-    }
+    const std::wstring& iTunesPathPrefix = iTunesDirectory();
+    if (directoryExists(iTunesPathPrefix))
+        return modifyPathWith(iTunesPathPrefix);
 
-    if (prependPath(pathPrefix))
-        return true;
-
-    fatalError(programName, L"Failed to modify PATH environment variable.");
+    fatalError(programName, L"Couldn't find path to Apple Application Support (AAS) or iTunes via the registry.  Do you have iTunes installed?");
     return false;
 #endif
 }

Modified: trunk/Tools/ChangeLog (274768 => 274769)


--- trunk/Tools/ChangeLog	2021-03-22 19:00:23 UTC (rev 274768)
+++ trunk/Tools/ChangeLog	2021-03-22 19:00:44 UTC (rev 274769)
@@ -1,3 +1,18 @@
+2021-03-22  Tyler Wilcock  <[email protected]>
+
+        AppleWin can't start due to "Failed to determine path to AAS directory." because iTunes changed the registry key
+        https://bugs.webkit.org/show_bug.cgi?id=219015
+
+        Reviewed by Alex Christensen.
+
+        It appears that iTunes no longer sets the Apple Application Support
+        registry entry.  Fallback to trying to find the iTunes installation
+        directory if the AAS directory is not present.
+
+        * win/DLLLauncher/DLLLauncherMain.cpp:
+        (iTunesDirectory): Added.
+        (modifyPath):
+
 2021-03-19  Darin Adler  <[email protected]>
 
         [Cocoa] Make it possible to release a WKWebView on a non-main thread without a crash due to WKScriptMessage race

Modified: trunk/Tools/win/DLLLauncher/DLLLauncherMain.cpp (274768 => 274769)


--- trunk/Tools/win/DLLLauncher/DLLLauncherMain.cpp	2021-03-22 19:00:23 UTC (rev 274768)
+++ trunk/Tools/win/DLLLauncher/DLLLauncherMain.cpp	2021-03-22 19:00:44 UTC (rev 274769)
@@ -84,6 +84,11 @@
     return applePathFromRegistry(L"SOFTWARE\\Apple Inc.\\Apple Application Support", L"InstallDir");
 }
 
+static wstring iTunesDirectory()
+{
+    return applePathFromRegistry(L"SOFTWARE\\Apple Computer, Inc.\\iTunes\\", L"InstallDir");
+}
+
 static bool prependPath(const wstring& directoryToPrepend)
 {
     wstring pathVariable = L"PATH";
@@ -130,18 +135,23 @@
     return true;
 
 #else
+    auto modifyPathWith = [&] (const wstring& pathPrefix) {
+        if (!prependPath(pathPrefix)) {
+            fatalError(programName, L"Failed to modify PATH environment variable.");
+            return false;
+        }
+        return true;
+    };
 
-    const wstring& pathPrefix = appleApplicationSupportDirectory();
+    const wstring& applicationSupportPathPrefix = appleApplicationSupportDirectory();
+    if (directoryExists(applicationSupportPathPrefix))
+        return modifyPathWith(applicationSupportPathPrefix);
 
-    if (!directoryExists(pathPrefix)) {
-        fatalError(programName, L"Failed to determine path to AAS directory.");
-        return false;
-    }
+    const wstring& iTunesPathPrefix = iTunesDirectory();
+    if (directoryExists(iTunesPathPrefix))
+        return modifyPathWith(iTunesPathPrefix);
 
-    if (prependPath(pathPrefix))
-        return true;
-
-    fatalError(programName, L"Failed to modify PATH environment variable.");
+    fatalError(programName, L"Couldn't find path to Apple Application Support (AAS) or iTunes via the registry.  Do you have iTunes installed?");
     return false;
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to