summaryrefslogtreecommitdiff
path: root/src/porting.cpp
diff options
context:
space:
mode:
authoradrido <robots_only_adrido@gmx.com>2018-10-26 21:37:51 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-10-26 21:37:51 +0200
commit2322078fe480a338422b35ee29fee3c0767f3e1d (patch)
tree3c935142cc66f0f237d8a6211ae09075fab62bab /src/porting.cpp
parent45b52f6d5a7c8389da8f4cb5c5294a430255a248 (diff)
downloadminetest-2322078fe480a338422b35ee29fee3c0767f3e1d.tar.gz
minetest-2322078fe480a338422b35ee29fee3c0767f3e1d.tar.bz2
minetest-2322078fe480a338422b35ee29fee3c0767f3e1d.zip
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
Diffstat (limited to 'src/porting.cpp')
-rw-r--r--src/porting.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/porting.cpp b/src/porting.cpp
index 302e6989a..a19c39456 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -380,14 +380,21 @@ bool setSystemPaths()
"Failed to get current executable path");
pathRemoveFile(buf, '\\');
+ std::string exepath(buf);
+
// Use ".\bin\.."
- path_share = std::string(buf) + "\\..";
+ 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:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
+ // 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;