mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Added support for environment variable SQUIRREL_TEMP to Setup.exe
Allows to control where Setup.exe will extract and execute the package
This commit is contained in:
@@ -137,6 +137,11 @@ int CUpdateRunner::ExtractUpdaterAndRun(wchar_t* lpCommandLine, bool useFallback
|
||||
wchar_t logFile[MAX_PATH];
|
||||
std::vector<CString> to_delete;
|
||||
|
||||
wchar_t *envSquirrelTemp = _wgetenv(L"SQUIRREL_TEMP");
|
||||
if (envSquirrelTemp) {
|
||||
_swprintf_c(targetDir, _countof(targetDir), L"%s", envSquirrelTemp);
|
||||
}
|
||||
else {
|
||||
if (!useFallbackDir) {
|
||||
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, targetDir);
|
||||
} else {
|
||||
@@ -161,6 +166,7 @@ int CUpdateRunner::ExtractUpdaterAndRun(wchar_t* lpCommandLine, bool useFallback
|
||||
}
|
||||
|
||||
wcscat_s(targetDir, _countof(targetDir), L"\\SquirrelTemp");
|
||||
}
|
||||
|
||||
if (!CreateDirectory(targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
|
||||
wchar_t err[4096];
|
||||
|
||||
Reference in New Issue
Block a user