From 2bd3135dfbece2257490c417ced63aa1a0503488 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Sat, 17 Oct 2026 00:13:46 +0300 Subject: #6441 Make initConfiguration failures more detailed --- indra/llfilesystem/lldir_mac.cpp | 76 ++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 11 deletions(-) (limited to 'indra/llfilesystem/lldir_mac.cpp') diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index 521057764c..5c64beca78 100644 --- a/indra/llfilesystem/lldir_mac.cpp +++ b/indra/llfilesystem/lldir_mac.cpp @@ -137,19 +137,10 @@ LLDir_Mac::LLDir_Mac() // mOSUserAppDir mOSUserAppDir = mOSUserDir; -#if LL_VELOPACK - // Detect a portable (Velopack) install: the executable lives at - // ".../MyApp.app/Contents/MacOS/". If the portable package - // dropped a ".portable" marker next to "MyApp.app" (i.e. one level - // above the bundle itself), keep user data (settings, logs, etc.) - // beside the bundle instead of ~/Library/Application Support. This - // only applies to Velopack-portable builds; a DMG/NSIS-style - // install never produces this marker, so a normally-installed - // viewer is unaffected. + // mExecutableDir == .../MyApp.app/Contents/MacOS std::string bundle_root; // .../MyApp.app if (!mExecutableDir.empty()) { - // mExecutableDir == .../MyApp.app/Contents/MacOS std::string contents_dir = getDirName(mExecutableDir); // .../MyApp.app/Contents if (!contents_dir.empty()) { @@ -157,7 +148,26 @@ LLDir_Mac::LLDir_Mac() } } std::string install_root = bundle_root.empty() ? std::string() : getDirName(bundle_root); - if (isPortableInstall(install_root)) + bool is_applications_install = (install_root.rfind("/Applications", 0) == 0); + bool is_dmg = (mExecutablePathAndName.rfind("/Volumes/", 0) == 0); + bool is_translocated = (mExecutablePathAndName.find("/AppTranslocation/") != std::string::npos); + +#if LL_VELOPACK + // Detect a portable (Velopack) install: the executable lives at + // ".../MyApp.app/Contents/MacOS/". If the portable package + // dropped a ".portable" marker next to "MyApp.app" (i.e. one level + // above the bundle itself), keep user data (settings, logs, etc.) + // beside the bundle instead of ~/Library/Application Support. This + // only applies to Velopack-portable builds; a DMG/NSIS-style + // install never produces this marker, so a normally-installed + // viewer is unaffected.if (!is_dmg && !is_translocated && !is_applications_install && !install_root.empty()) + + // macos doesn't have the .portable marker , but check it just in case. + bool is_portable = isPortableInstall(install_root); + // For a velopack build, assume that running nor from a dmg means 'portable'. + is_portable |= !is_dmg && !is_translocated && !is_applications_install && !install_root.empty(); + + if (is_portable) { std::string portable_dir; if (CreateDirectory(install_root, PORTABLE_USER_DATA_DIRNAME, &portable_dir)) @@ -174,6 +184,50 @@ LLDir_Mac::LLDir_Mac() } #endif // LL_VELOPACK + if (is_dmg) + { + // Running directly off a still-mounted DMG; the user never + // dragged the app out to install it. + mRunContextDescription = "Mounted disk image (DMG)"; + } + else if (is_translocated) + { + // Gatekeeper's App Translocation makes an unregistered, quarantined + // app (e.g. one simply unzipped in Downloads/ and double-clicked + // without ever being moved) appear to run from a randomized + // read-only path under + // "/private/var/folders/.../AppTranslocation/.../d/MyApp.app", + // even though the on-disk bundle still lives wherever it was + // extracted. + mRunContextDescription = "App Translocation (unregistered/quarantined copy)"; + } + else if (is_applications_install) + { + // Bundle lives directly under /Applications: a normal, properly + // installed copy. + mRunContextDescription = "Standard install (/Applications)"; + } +#if LL_VELOPACK + else if (is_portable) + { + mRunContextDescription = "Portable (extracted archive, " + install_root + ")"; + } +#endif // LL_VELOPACK + else if (!install_root.empty()) + { + // Bundle is present on local disk, intact, and not translocated + // or mounted from a DMG, but it is NOT under /Applications. This + // is the classic "downloaded a zip/tar, extracted it somewhere, + // and ran the .app directly from that folder" case - i.e. what + // users may call a "portable" install even though no formal + // portable packaging was used. + mRunContextDescription = "Running from extracted archive or non-standard folder (" + install_root + ")"; + } + else + { + mRunContextDescription = "Unknown install location"; + } + // mTempDir //Aura 120920 std::filesystem::temp_directory_path() not yet implemented on mac. :( std::string tmpdir = getSystemTempFolder(); -- cgit v1.3