build: Added portable Windows build
* implemented detecting if Sourcetrail runs as installed version by checking if user folder exists next to exe * removed "deploy"-flag mechanism for windows builds * moved code to set the app path for windows builds to includesWindows.h * implemented functions in setup bash script to copy dlls * bash functions for installer and portable packaging
This commit is contained in:
@@ -6,53 +6,9 @@ std::string AppPath::m_appPath = "";
|
||||
|
||||
std::string AppPath::getAppPath()
|
||||
{
|
||||
if (m_appPath.length() <= 0)
|
||||
{
|
||||
setupAppPath();
|
||||
}
|
||||
|
||||
return m_appPath;
|
||||
}
|
||||
|
||||
void AppPath::setupAppPath()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
|
||||
std::wstring wPath(path);
|
||||
m_appPath = std::string(wPath.begin(), wPath.end());
|
||||
|
||||
size_t pos = m_appPath.find_last_of("/");
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
pos = m_appPath.find_last_of("\\");
|
||||
}
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
m_appPath = m_appPath.substr(0, pos + 1);
|
||||
}
|
||||
#elif _WIN64
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
|
||||
std::wstring wPath(path);
|
||||
m_appPath = std::string(wPath.begin(), wPath.end());
|
||||
|
||||
size_t pos = m_appPath.find_last_of("/");
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
pos = m_appPath.find_last_of("\\");
|
||||
}
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
m_appPath = m_appPath.substr(0, pos + 1);
|
||||
}
|
||||
#endif // WINDOWS
|
||||
}
|
||||
|
||||
bool AppPath::setAppPath(std::string path)
|
||||
{
|
||||
if(!path.empty())
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#elif _WIN64
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#endif // WINDOWS
|
||||
#endif // _WIN32
|
||||
|
||||
class AppPath
|
||||
{
|
||||
@@ -20,8 +16,6 @@ public:
|
||||
static bool setAppPath(std::string path);
|
||||
|
||||
private:
|
||||
static void setupAppPath();
|
||||
|
||||
static std::string m_appPath;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user