Archive: rename function doesnt work


rename function doesnt work
im trying tu use an installer cause i have 2 different language versions.
the programm read the strings from the file speech.dcp.
no matter what the language is, so i take on language as standard speech.dcp file, and ifsomeone klick the other language i want to rename the speech files.
speech.dcp (delete) or rename -> speech_1.dcp
speech_eng.dcp -> speech.dcp - programm can use the english translation.

this is the code in the Function .onInit:
Rename "$INSTDIR\speech.dcp" "$INSTDIR\speech_ger.dcp"
Rename "$INSTDIR\speech_eng.dcp" "$INSTDIR\speech.dcp"

i dont know if the file exists before extraction, but i guess not, these files are supposed to be installed by me.
so i assume with the above code, i try to rename files, before they are really there.

thx demiller9 for the help so far,
any suggestions what is the solution for that?


What's the path for $INSTDIR? Try a MessageBox to see if there's a valid path for ya.


the path should be the right one, its the root directory.
but isnt it the problem, that the files arent there when i try to rename them?

how can i test the the path with a messagebox?
MessageBox MB_OK "$INSTDIR" - like this?


Originally posted by Rocco
the path should be the right one, its the root directory.
but isnt it the problem, that the files arent there when i try to rename them?

how can i test the the path with a messagebox?
MessageBox MB_OK "$INSTDIR" - like this?
To see if a file is there, use IfFileExits.
MessageBoxMB_OK"$INSTDIR"


ok i checked the path with
MessageBox MB_OK "$INSTDIR"
and it is the right one.

but the problem is the files arent there at this moment.
what is somehow logical for me, cause the first thing are the settings, and in this moment the programm (and the files that i want to rename) isnt installed. so this operations must be performed after the install-process or in the compressed setup file.
and this is my problem, what can i do?


Ok, I understand...

Maybe you should try the /oname from instruction File.

Maybe you should try to send it to the pluginsdir and then call Rename.


ok i got a solution, finally. (thank god, and all how helped me further :-))
i copied the text after the FILE commands and now it works.

${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
Delete $INSTDIR\speech.dcp
Rename "$INSTDIR\speech_eng.dcp" "$INSTDIR\speech.dcp"
${Break}
${EndSwitch}