1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Windows: Cpack wix installer (#6153)

Create CPack WIX msi Installer for RUN_IN_PLACE=0 builds
Correct paths on Windows for RUN_IN_PLACE=0
Install only required font files
Games have their own components, and "minimal" is optional
This commit is contained in:
adrido 2018-10-26 21:37:51 +02:00 committed by SmallJoker
parent 45b52f6d5a
commit 2322078fe4
8 changed files with 118 additions and 33 deletions

View file

@ -380,14 +380,21 @@ bool setSystemPaths()
"Failed to get current executable path");
pathRemoveFile(buf, '\\');
// Use ".\bin\.."
path_share = std::string(buf) + "\\..";
std::string exepath(buf);
// Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
// Use ".\bin\.."
path_share = exepath + "\\..";
if (detectMSVCBuildDir(exepath)) {
// The msvc build dir schould normaly not be present if properly installed,
// but its usefull for debugging.
path_share += DIR_DELIM "..";
}
// Use "C:\Users\<user>\AppData\Roaming\<PROJECT_NAME_C>"
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");
path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME;
path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME_C;
return true;
}
@ -561,6 +568,10 @@ void initializePaths()
if (!setSystemPaths())
errorstream << "Failed to get one or more system-wide path" << std::endl;
# ifdef _WIN32
path_cache = path_user + DIR_DELIM + "cache";
# else
// Initialize path_cache
// First try $XDG_CACHE_HOME/PROJECT_NAME
const char *cache_dir = getenv("XDG_CACHE_HOME");
@ -577,7 +588,8 @@ void initializePaths()
}
// Migrate cache folder to new location if possible
migrateCachePath();
#endif
# endif // _WIN32
#endif // RUN_IN_PLACE
infostream << "Detected share path: " << path_share << std::endl;
infostream << "Detected user path: " << path_user << std::endl;