Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   How to ReserveFile in other directory? (http://forums.winamp.com/showthread.php?t=286736)

mergisius 12th February 2008 11:12

How to ReserveFile in other directory?
 
Well, the problem is that my *.ini files is in other catalog. Problem is similar to this one http://forums.winamp.com/showthread....ht=ReserveFile, but I don't get how he solved it. If you would do like there "!insertmacro MUI_INSTALLOPTIONS_EXTRACT "installoptions.ini" it wouldn't find it.

My code:
code:

ReserveFile "InstallFields\ServerSettingsPageDB.ini"
ReserveFile "InstallFields\ServerSettingsPageUser.ini"
ReserveFile "InstallFields\ServerSettingsPageDocs.ini"

<.... >

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "InstallFields\ServerSettingsPageDB.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "InstallFields\ServerSettingsPageUser.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "InstallFields\ServerSettingsPageDocs.ini"
FunctionEnd

Function SettingsPageDBShow
!insertmacro SectionFlagIsSet ${Server_Recreate} ${SF_SELECTED} 0 end
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "InstallFields\ServerSettingsPageDB.ini"
end:
FunctionEnd

Function ServerSettingsPageDBLeave
!insertmacro MUI_INSTALLOPTIONS_READ $DBSERVER_NAME "InstallFields\ServerSettingsPageDB.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $DATABASE_NAME "InstallFields\ServerSettingsPageDB.ini" "Field 5" "State"
FunctionEnd

Function SettingsPageUserShow
!insertmacro SectionFlagIsSet ${Server_Recreate} ${SF_SELECTED} 0 end
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "InstallFields\ServerSettingsPageUser.ini"
end:
<...>



If I wrote "InstallFields\InitFile.ini" in every place where I need to use InitFile.ini, i would get error "Error opening file <..> for writing".

So, how should I corectly reserve a file which is in different directory?

Afrow UK 12th February 2008 11:23

According to that code your ini files are in the same folder as your script (MUI_INSTALLOPTIONS_EXTRACT), so what's the problem?

Stu

mergisius 12th February 2008 12:11

Quote:

Originally posted by Afrow UK
According to that code your ini files are in the same folder as your script (MUI_INSTALLOPTIONS_EXTRACT), so what's the problem?

Stu

Well, I edited my code in the post.

Actually, I want to fix that mess with install scripts, so I would like to make folders like "IniFiles", "Scripts", "BatFiles", "Images". That's why i need to reserve files from other directory than my scripts are.

Afrow UK 12th February 2008 12:53

ReserveFile will work if the file is there relative to your script.

Your code won't work now as it is. You need to use MUI_INSTALLOPTIONS_EXTRACT_AS.

Stu

mergisius 19th February 2008 06:02

Quote:

Originally posted by Afrow UK
ReserveFile will work if the file is there relative to your script.

Your code won't work now as it is. You need to use MUI_INSTALLOPTIONS_EXTRACT_AS.

Stu

Thank you :)


So, now it looks like this and works fine :)
code:

!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "IniFiles\ServerSettingsPageDB.ini" "ServerSettingsPageDB.ini"

<...>

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ServerSettingsPageDB.ini"



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

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.