summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-13 12:31:44 +0800
committerOpportunityLiu <[email protected]>2019-07-13 12:31:44 +0800
commite8a03485701e33b737bbf942708bfcdf841acaac (patch)
tree1c1ce8bade217bd19be54ad545a5b7613fcdc334 /scripts
parentfd480a076b33e4b7e62f339fbe70bbfead22789c (diff)
add trim
Diffstat (limited to 'scripts')
-rw-r--r--scripts/installer.nsi38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index c00918fe0..5a5598a29 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -147,6 +147,39 @@ VIAddVersionKey /LANG=0 ProductVersion ${VERSION_FULL}
Var NOADMIN
+Function TrimQuote
+ Exch $R1 ; Original string
+ Push $R2
+
+Loop:
+ StrCpy $R2 "$R1" 1
+ StrCmp "$R2" "$\"" TrimLeft
+ StrCmp "$R2" "$\r" TrimLeft
+ StrCmp "$R2" "$\n" TrimLeft
+ StrCmp "$R2" "$\t" TrimLeft
+ StrCmp "$R2" " " TrimLeft
+ GoTo Loop2
+TrimLeft:
+ StrCpy $R1 "$R1" "" 1
+ Goto Loop
+
+Loop2:
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" "$\"" TrimRight
+ StrCmp "$R2" "$\r" TrimRight
+ StrCmp "$R2" "$\n" TrimRight
+ StrCmp "$R2" "$\t" TrimRight
+ StrCmp "$R2" " " TrimRight
+ GoTo Done
+TrimRight:
+ StrCpy $R1 "$R1" -1
+ Goto Loop2
+
+Done:
+ Pop $R2
+ Exch $R1
+FunctionEnd
+
; Installer
Function .onInit
${GetOptions} $CMDLINE "/NOADMIN" $NOADMIN
@@ -172,6 +205,11 @@ Function .onInit
${If} $InstDir == ""
StrCpy $InstDir ${PROGRAMFILES}\xmake
${EndIf}
+
+ Push $InstDir
+ Call TrimQuote
+ Pop $InstDir
+
FunctionEnd
Section "XMake (required)" InstallExeutable