1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Linux: Allow AppImage file to start with "veracrypt" in any case

This commit is contained in:
Mounir IDRASSI
2025-06-09 11:07:07 +09:00
parent 69852fad9a
commit 87a5024a5b

View File

@@ -280,18 +280,25 @@ namespace VeraCrypt
if (appImageEnv && appDirEnv) if (appImageEnv && appDirEnv)
{ {
string appDirString = appDirEnv; string appDirString = appDirEnv;
string appImageFileString = appImageEnv; const std::string appImageMountPrefix = "/tmp/.mount_";
const string appImageMountPrefix1 = "/tmp/.mount_Veracr"; const std::string appImageMountSuffixPattern = "veracr"; // Lowercase for case-insensitive comparison
const string appImageMountPrefix2 = "/tmp/.mount_VeraCr";
if (!appDirString.empty() && if (!appDirString.empty() &&
executablePath.rfind(appDirString, 0) == 0 && executablePath.rfind(appDirString, 0) == 0 &&
(appDirString.rfind(appImageMountPrefix1, 0) == 0 || appDirString.rfind(appImageMountPrefix2, 0) == 0)) appDirString.rfind(appImageMountPrefix, 0) == 0)
{
// Ensure appDirString has enough room for appImageMountPrefix and appImageMountSuffixPattern
if (appDirString.length() > appImageMountPrefix.length() + appImageMountSuffixPattern.length())
{
std::string actualSuffixPart = appDirString.substr(appImageMountPrefix.length(), appImageMountSuffixPattern.length());
if (StringConverter::ToLower(actualSuffixPart) == appImageMountSuffixPattern)
{ {
// All conditions met, this is the AppImage scenario. // All conditions met, this is the AppImage scenario.
return true; return true;
} }
} }
}
}
return false; return false;
} }
#endif #endif