Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   rename function doesnt work (http://forums.winamp.com/showthread.php?t=266157)

Rocco 19th February 2007 18:26

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?

Joel 19th February 2007 18:43

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

Rocco 19th February 2007 19:11

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?

Joel 19th February 2007 19:57

Quote:

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.
PHP Code:

MessageBox MB_OK "$INSTDIR


Rocco 19th February 2007 20:16

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?

Joel 20th February 2007 01:24

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.

Rocco 21st February 2007 14:11

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}


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

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.