2014-06-16 34 views
0

我有一個安裝程序,把一些文件放在客戶端機器上,所以我想要相同的安裝程序是更新安裝程序,所以我想提出一個條件,如果這些文件已經存在我會顯示一個對話框給用戶選擇是否要替換文件。覆蓋有矛盾的文件Izpack

我的IzPack代碼是這樣的

<pack name="Product" required="yes"> 
      <file src="../@{project.artifactId}.jar" targetdir="$INSTALL_PATH" /> 
      <fileset dir="../resources" targetdir="$INSTALL_PATH/resources"> 
       <include name="**/*" /> 
      </fileset> 

      <fileset dir="dependency" targetdir="$INSTALL_PATH/lib"> 
       <include name="**/*" /> 
      </fileset> 

      <fileset dir="../resources/icons" targetdir="$INSTALL_PATH"> 
       <include name="favicon.ico" /> 
      </fileset> 

</pack> 

回答

0

我使用屬性覆蓋與價值解決了這個問題asktrue像下面

的代碼,你可以從你的源忽略某些文件dir也與標籤排除

<file src="../resources/myfile.properties" targetdir="$INSTALL_PATH/resources" override="asktrue" /> 
<fileset dir="../resources" targetdir="$INSTALL_PATH/resources"> 
    <exclude name="**/myfile.properties" /> 
    <include name="**/*" /> 
</fileset> 
+0

您在哪裏放置條件如果這些f iles已經存在'並且'向用戶顯示一個對話框,選擇他是否想要替換或不替換文件'? ''並不能滿足要求。 – sunbabaphu

+0

的屬性來覆蓋你可以把值「asktrue」這裏是文檔http://docs.codehaus.org/display/IZPACK/Pack+FileSet –

+0

好吧。而且,不應該使用下面的代碼來解決問題,它包含'override =「asktrue」' – sunbabaphu