winman2004
30th October 2013 14:38 UTC
remove last character if it is \
i want a code in nsis which can check for last character in a variable. If last character is / then i want to remove it.
Ex:
If $var is C:\mypath\ then i want output as only C:\mypath
if $var is C:\mypath then output is C:\mypath
jpderuiter
30th October 2013 15:02 UTC
You can 'abuse' the EXEDIR variable for that.
See http://nsis.sourceforge.net/Search_For_a_File (first code sample)
For a more robust solution see:
http://forums.winamp.com/showthread.php?t=254760
world80
30th October 2013 20:34 UTC
Strcpy $0 $var "" -1
Strcmp $0 "\" 0 +2
Strcpy $var $var -1
shadowpoa
1st November 2013 16:19 UTC
great solution
Hi,
Reading posts here about same subject I've got one of the best ways to do that.
Simple copy your var to $outdir them copy it back.
$Outdir have special a treatment to remove the slash on the end of string
Doing like this will solve your problem.
StrCpy $OUTDIR $var
StrCpy $var $OUTDIR