[+] UNIX binaries should use the /opt mount when possible

This commit is contained in:
Reece Wilson 2021-10-16 00:35:49 +01:00
parent 586ec565e1
commit d28a0aa291

View File

@ -25,6 +25,7 @@ namespace Aurora::IO::FS
static AuOptional<AuString> gSystemLibPath2;
static AuOptional<AuString> gUserLibPath;
static AuOptional<AuString> gUserLibPath2;
static const AuString kUnixAppData {"/opt"};
AUKN_SYM bool GetSystemDomain(AuString &path)
{
@ -162,7 +163,14 @@ namespace Aurora::IO::FS
gHomeDirectory = ".";
}
gApplicationData = gHomeDirectory;
if (FS::DirExists(kUnixAppData))
{
gApplicationData = kUnixAppData;
}
else
{
gApplicationData = gHomeDirectory;
}
SetUnixPaths(gUserLibPath, gUserLibPath2, "/usr/lib");
SetUnixPaths(gSystemLibPath, gSystemLibPath2, "/lib");
@ -204,12 +212,15 @@ namespace Aurora::IO::FS
if (gRuntimeConfig.fio.defaultBrand.has_value())
{
gApplicationData += "/" + gRuntimeConfig.fio.defaultBrand.value() + "/System";
#if defined(AURORA_IS_POSIX_DERIVED)
gHomeDirectory += "/." + gRuntimeConfig.fio.defaultBrand.value() + "/Profile";
#else
gHomeDirectory += "/" + gRuntimeConfig.fio.defaultBrand.value() + "/Profile";
#endif
}
else
#endif
{
gApplicationData += "/.application";
gHomeDirectory += "/.config"; //most unix programs hide their private user data under here
}