diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-10-21 09:16:00 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-10-21 09:16:00 +0800 |
| commit | dc3524d24ae63c1024c094b67fb13f41f49d5637 (patch) | |
| tree | 51dc3f0b4e20faae3f807984eabde07b924570f9 /indra/llfilesystem/lldir_mac.cpp | |
| parent | 61e65e2c95779d29496e5859a6edac82fc3b1ddb (diff) | |
| parent | 8b7d1044e026a9e45bfc9281bb856b0c91183f87 (diff) | |
Merge tag 'Second_Life_Release#8b7d1044-26.5' into 26.5
Diffstat (limited to 'indra/llfilesystem/lldir_mac.cpp')
| -rw-r--r-- | indra/llfilesystem/lldir_mac.cpp | 76 |
1 files changed, 65 insertions, 11 deletions
diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index fc2d54a880..906894868e 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/<exe>". 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/<exe>". 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(); |
