In upgrade installer, I want to set a rule for overwriting existing files and folders. suppose I have a folder named config in my${installdir}. during the upgrading, i never want to override this folder because of having some configuration files in it. and I have the set the <overwritepolicy>onlyIfNewer</overwritepolicy> for my XML file.

How can I implement such a feature?

 <folderList>
            <folder> 
                <description>Program Files</description>
                <destination>${installdir}</destination>
                <name>programfiles</name>
                <platforms>all</platforms>
                <distributionFileList>
                    <distributionDirectory>
                        <origin>D:/InstallBuilder/SampleProject</origin>
                    </distributionDirectory>
                </distributionFileList>
            </folder>
        </folderList>

asked 31 Mar '16, 07:55

John123's gravatar image

John123
6779
accept rate: 0%


You would need to exclude packing the "config" folder from the main <folder> setting <excludeFiles> in the <distributionDirectory>, and create a new one that just pack the "config" folder.

Then you could follow this approach to change the overwrite policy for this single folder.

link

answered 01 Apr '16, 11:20

alejandror's gravatar image

alejandror ♦♦
1.3k127
accept rate: 31%

while fresh installation all file should unpack but in upgrade only "config" folder will not overwrite. can you plz give the example code for it.

(05 Apr '16, 09:04) John123

You could create a <folder> that only will be unpacked if a condition is accomplished. Find in the next link how to do that: http://installbuilder.bitrock.com/docs/installbuilder-userguide.html#_conditionally_unpacking_a_folder Regarding that rule you could check that the ${project.installationType} variable is not set to 'upgrade'.

(05 Apr '16, 09:51) jesus ♦♦

Hi Jesus

what I am doing wrong here. it's not working for me.

<folderList>
    <folder> 
      <description>Program Files</description>
      <destination>${installdir}</destination>
        <name>programfiles</name>
        <platforms>all</platforms>
        <distributionFileList>
         <distributionDirectory allowWildcards="1">
        <origin>D:/InstallBuilder/SampleProject</origin>                               <excludeFiles>D:/InstallBuilder/SampleProject/config/configure.properties</excludeFiles>
    </distributionDirectory>
    </distributionFileList>
   </folder>

   <folder>
     <description>Program Files</description>
      <destination>${installdir}</destination>
      <name>programfiles</name>
      <platforms>all</platforms>
      <distributionFileList>
      <distributionFile>
         <origin>D:/InstallBuilder/SampleProject/config/configure.properties</origin>
     </distributionFile>
     </distributionFileList>
    <ruleEvaluationLogic>and</ruleEvaluationLogic>
    <ruleList>
       <compareText text="${project.installationType}" logic="does_not_equal" value="upgrade"/>
    </ruleList>
    </folder>
 </folderList>
link

answered 06 Apr '16, 05:15

John123's gravatar image

John123
6779
accept rate: 0%

edited 07 Apr '16, 02:06

any update?

(11 Apr '16, 09:09) John123

Is your installer using upgrade mode? Otherwise, the snippet will not work as the variable project.installationType would not be set to "upgrade". Additionally, it will likely fail due to both folders having the same name.

As mentioned in my previous answer, you would need to follow this approach to set the overwritePolicy only for the folder containing the config file.

<folderList> <folder> <description>Program Files</description> <destination>${installdir}</destination> <name>programfiles</name> <platforms>all</platforms> <distributionFileList> <distributionDirectory allowWildcards="1"> <origin>D:/InstallBuilder/SampleProject</origin> <excludeFiles>D:/InstallBuilder/SampleProject/config/configure.properties</excludeFiles> </distributionDirectory> </distributionFileList> </folder> <!-- folders before this one will use project's global overwritePolicy --> <!-- ... --> <folder> <name>dummy1</name> <actionList> <!-- change policy to never overwrite files --> <setInstallerVariable name="project.overwritePolicy" value="never"/> </actionList> </folder> <folder> <description>Program Files</description> <destination>${installdir}</destination> <name>configureproperties</name> <platforms>all</platforms> <distributionFileList> <distributionFile> <origin>D:/InstallBuilder/SampleProject/config/configure.properties</origin> </distributionFile> </distributionFileList> </folder> <folder> <name>dummy2</name> <actionList> <!-- change policy to always overwrite files --> <setInstallerVariable name="project.overwritePolicy" value="onlyIfNewer"/> </actionList> </folder> <!-- folders after one above will have overwritePolicy set to onlyIfNewer --> </folderList>

link

answered 14 Apr '16, 06:11

alejandror's gravatar image

alejandror ♦♦
1.3k127
accept rate: 31%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×155
×22
×1

Asked: 31 Mar '16, 07:55

Seen: 654 times

Last updated: 14 Apr '16, 06:11