Skip to content
⌘ NSIS Forum Archive

New Archive Functions (StrRep and StrSlash)

1 posts

dirtydingus#

New Archive Functions (StrRep and StrSlash)

I just posted a new archive page with my String Replace function and its smaller Slash/BackSlash converter brother (StrSlash)



The latter is very useful if you are installing things that are going to be viewed on a webserver and you need to do some magic to convert filenames to URLs and vice versa

E.g. say ${WEBROOT} is "c:\webroot\" and ${FILE} is "c:\webroot\some\path\to\here.htm" and you want to get the URL for it you can do

StrLen $R0 ${WEBROOT}
StrCpy $R1 ${FILE} 80 $R0 ; strip root
Push $R1
Push "\"
Call StrSlash
Pop $R1
StrCpy $R1 "http://myhost/$R1"
;$R1 == "http://myhost/some/path/to/here.htm"
Share & Enjoy

DD