00zero
25th May 2006 17:21 UTC
help changing dir seperators
in my install i make an m file that is used by mathematica that simply points to a directory where the install took place. The problem is that the dir structure in mathematica is semperate by teo slashes {c:\\program files\\ vs the normal c:\program files\} i know there is the wordinsert but it only looks at the nth instance and i dont know how long the director structure may be. is ther an easy to relapce all the \ with \\? i say the str replace but im having trouble implmenting it.
thanks
Jonathan
Afrow UK
25th May 2006 17:33 UTC
NSIS Wiki is your friend.
http://nsis.sourceforge.net/StrReplace_v4
-Stu
Red Wine
25th May 2006 17:55 UTC
* Put a backslash here means replace this text with a real
backslash as for some reason backslashes removed from code.
OutFile "Output.exe"
Section -
StrCpy $0 ''
StrCpy $R0 "c:\program files\my dir\"
StrCpy $R1 0
_loop:
StrCpy $R2 $R0 1 $R1
StrCpy '$0' '$0$R2'
StrCmp $R2 'put a backslash here' +1 +3
StrCpy $0 '$0$R2'
StrCpy '$R2' '$R2also put a backslash here'
StrCmp $R2 '' _end
IntOp $R1 $R1 + 1
goto _loop
_end:
messagebox mb_ok '$0'
SectionEnd
00zero
25th May 2006 18:24 UTC
thanks
ill give that a try.
-jonathan