Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   changing a \ to / in a properties file (http://forums.winamp.com/showthread.php?t=224437)

bigbooty 22nd August 2005 21:58

changing a \ to / in a properties file
 
Hi,

I want to change a Java properties file. I have changed some strings but I need to change path designators. To keep it a simple request: I am trying to change all back slashes [\] to forward slashes [/].

I have tried using AdvReplaceInFile it does not work for me in this instance.

Thanks,
audacious

Java uses a forward slash as a path designator that gets converted to the correct path designator for the OS environment at runtime.

goldy1064 22nd August 2005 22:41

Just loop through the length of the string and compare each index with '/' and write to a new string with '\'.
code:

StrCpy $R0 $OrignalString
StrLen $R1 $R0
StrCpy $R4 "" ; will hold final string
${For} $R2 0 $R1 ;for $R2=0 $R2<$R1 $R2++
StrCpy $R3 $R0 1 $R2 ; Copy the $R2 value of the string
${If} $R3 == "/"
StrCpy $R4 "$R4\"
${Else}
StrCpy $R4 "$R4$R3"
${EndIf}
${Next}
StrCpy $OriginalString $R4


galevsky 8th November 2007 14:33

Let's reverse / and \ in code above.

Gal'


All times are GMT. The time now is 04:37.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.