Archive: changing a \ to / in a properties file


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.


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


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

Let's reverse / and \ in code above.

Gal'