Commit 465a3149 authored by Edric Milaret's avatar Edric Milaret Committed by gerrit2

autostart: fix link generation

Refs #74589

Change-Id: I78347cae63f7d88bad9c4f80e1da7e423aaf1267
parent 00e789a4
......@@ -74,6 +74,7 @@ section "install"
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
SetOutPath $INSTDIR
#Desktop
CreateShortCut "$DESKTOP\Ring.lnk" "$INSTDIR\Ring.exe" ""
......
......@@ -20,17 +20,17 @@
bool
Utils::CreateStartupLink() {
TCHAR userHome[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome);
TCHAR workingDirectory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, workingDirectory);
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, MAX_PATH);
std::wstring programPath(szPath);
std::wstring programPath(workingDirectory);
programPath += TEXT("\\RingClientWindows.exe");
TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
std::wstring linkPath(userHome);
linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk");
std::wstring linkPath(startupPath);
linkPath += TEXT("\\Ring.lnk");
return Utils::CreateLink(programPath.c_str(), linkPath.c_str());
}
......@@ -60,22 +60,22 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
void
Utils::DeleteStartupLink() {
TCHAR userHome[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome);
TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
std::wstring linkPath(userHome);
linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk");
std::wstring linkPath(startupPath);
linkPath += TEXT("\\Ring.lnk");
DeleteFile(linkPath.c_str());
}
bool
Utils::CheckStartupLink() {
TCHAR userHome[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome);
TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
std::wstring linkPath(userHome);
linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk");
std::wstring linkPath(startupPath);
linkPath += TEXT("\\Ring.lnk");
return PathFileExists(linkPath.c_str());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment