I have a problem where a user may enter the path and end the line with a '\' and later on I am concatinating a subdirectory to this path. If they use the file browser, the '\' is not there and I simply concatinate it along with my subdirectory. However, when the user enters the '\' themselves I don't know how to determine if the last character is a slash or not. Hope that makes sense... basically my problem is that if there is already a slash I'm getting 'path\\path'.
Thanks,
beez
how to check for a '\' at the end of a string
8 posts
$INSTDIR always gets its trailing back-slash removed. If you want to remove the trailing back-slash for another variable just copy it into $INSTDIR, $OUTDIR or $EXEDIR and copy it back.
awesome
Thanks! You Rock! 🙂
Thanks! You Rock! 🙂
This crazy workaround doesn't work anymore...
Strcpy $R0 "$PROGRAMFILES\"
Strcpy $R1 "$R0" '1' '-1'
messagebox mb_ok '$$R1 == [$R1]'
Strcmp $R1 "\" 0 +2
Strcpy $R0 "$R0" '-1'
messagebox mb_ok '$$R0 == [$R0]'
Yes, I use it. Thank you for your time 🙂
This crazy workaround doesn't work anymore...Which version of NSIS are you using? On my system with NSIS 2.37 it still works (I tried $INSTDIR, $OUTDIR and $EXEDIR)
2.37. I am sorry, it works. I must made a mistake when testing this "feature".