From e36005558da5610ba2c5b1c697fa0d54cd191b58 Mon Sep 17 00:00:00 2001 From: JFronny <33260128+JFronny@users.noreply.github.com> Date: Thu, 16 Jul 2020 17:12:18 +0200 Subject: [PATCH] Prevent a bug with mainBin being a global path instead of local --- UpTool build tool/BatchScripts.cs | 2 +- UpTool build tool/ShScripts.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/UpTool build tool/BatchScripts.cs b/UpTool build tool/BatchScripts.cs index 7eed18a..50f6cce 100644 --- a/UpTool build tool/BatchScripts.cs +++ b/UpTool build tool/BatchScripts.cs @@ -14,7 +14,7 @@ namespace UpTool_build_tool { installBat += "\r\n"; installBat += - $@"powershell ""$s=(New-Object -COM WScript.Shell).CreateShortcut('%appdata%\Microsoft\Windows\Start Menu\Programs\{programName}.lnk');$s.TargetPath='%cd%\{mainBin}';$s.Save()"""; + $@"powershell ""$s=(New-Object -COM WScript.Shell).CreateShortcut('%appdata%\Microsoft\Windows\Start Menu\Programs\{programName}.lnk');$s.TargetPath='%cd%\{Path.GetFileName(mainBin)}';$s.Save()"""; removeBat += "\r\n"; removeBat += $@"del ""%appdata%\Microsoft\Windows\Start Menu\Programs\{programName}.lnk"""; } diff --git a/UpTool build tool/ShScripts.cs b/UpTool build tool/ShScripts.cs index 75a042f..26a003b 100644 --- a/UpTool build tool/ShScripts.cs +++ b/UpTool build tool/ShScripts.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Text.RegularExpressions; namespace UpTool_build_tool @@ -17,7 +18,7 @@ namespace UpTool_build_tool { installSh += $@" echo ""[Desktop Entry]"" > {lnkName} -echo ""Exec={(wine ? "wine " : "")}{mainBin}"" >> {lnkName} +echo ""Exec={(wine ? "wine " : "")}{Path.GetFileName(mainBin)}"" >> {lnkName} echo ""Icon=application/x-shellscript"" >> {lnkName} echo ""Name={upRgx.Replace(programName, "")}"" >> {lnkName} echo ""StartupNotify=false"" >> {lnkName} @@ -29,7 +30,7 @@ echo ""Type=Application"" >> {lnkName}"; if (!string.IsNullOrWhiteSpace(mainBin)) { removeSh += "\r\n"; - removeSh += $@"pkill -f ""{mainBin}"""; + removeSh += $@"pkill -f ""{Path.GetFileName(mainBin)}"""; } installSh += $"\r\n{postInstall}"; removeSh += $"\r\n{postRemove}";