You are here

Escape characters for paths in NSIS

2 posts / 0 new
Last post
nnewton
Offline
Last seen: 2 years 1 month ago
Joined: 2007-07-06 02:14
Escape characters for paths in NSIS

Is this still an unresolvable issue with the NS installer?

https://portableapps.com/node/4530

I just installed the portable GPG and Enigmail and the path to my gpg.exe is being changed when I exit TB. The path for my TB includes a directory starting with a lowercase n, NSIS seems to turn this into some control character when it saves back to the "extensions.enigmail.agentPath" line in pref.js. Works fine with an uppercase N though.

This only happens with the path to gpg.exe, all the other paths in pref.js are fine.

nnewton
Offline
Last seen: 2 years 1 month ago
Joined: 2007-07-06 02:14
This finally annoyed me

This finally annoyed me enough that I decided to learn how to use NSIS and fix it myself.

Edit the ThunderbirdPortable.nsi file:

Add StrRep.nsh to the ;(NSIS Plugins) includes section near the top of the file:

!include StrRep.nsh

In the GPGEnvironment section, insert the following immediately before the FileWrite $0 `user_pref("extensions.enigmail.agentPath", "$GPGPATHDIRECTORY\gpg.exe");` line:

;Correct a problem with escape sequences, eg \n or \r in the path
${StrReplace} "$GPGPATHDIRECTORY" "\" "~TmpRepStr~" "$GPGPATHDIRECTORY"
${StrReplace} "$GPGPATHDIRECTORY" "~TmpRepStr~" "\\" "$GPGPATHDIRECTORY"

See here if you want to know why it needs two lines:

http://nsis.sourceforge.net/Talk:StrRep

Recompile with NSIS and run.

Log in or register to post comments