VMware Cloud Community
BenjaminGregors
Contributor
Contributor

How to include all files in a folder without the last directory in the folder

 I have header files in C: or foo or include and I want to put them into ${installdir}/include/foo but they all go to ${installdir}/include/foo/include. How do I drop the last folder without having to explicitly list all of the header files in C: or foo or include?


Thanks,


   Ben

Labels (1)
0 Kudos
8 Replies
AnonymousDefaul
Enthusiast
Enthusiast

Hi,

You could use an Advanced Filter that allows excluding files located at any level in the folder hierarchy of the <distributionDirectory>.

In this way you can pack C: or  or foo only with the header files.

Regards,

Michiel D'Hont

0 Kudos
BenjaminGregors
Contributor
Contributor

Hi Michael,

  I don't think I understand your response. I don't want to exclude any files from C: or  or foo or  or include in the installer. What I want to explicitly control is the destination folder for the header files. Right now InstallBuilder always appends the name of the folder to the installed location and I don't want that.

C: or  or foo or  or myheaders or  or more_headers gets installed at ${installdir}/include/more_headers and I want them installed at ${installdir}/ or  or include.

I have been able to do this by installing to a temp folder and then moving the files to the correct folder but I am looking for an easier way to do that.

Thanks,

  Ben

0 Kudos
AnonymousDefaul
Enthusiast
Enthusiast

Hi Ben,

Please accept my apologies for the misunderstanding. Unfortunately it's not possible to do this.

Best regards,

Michiel D'Hont

0 Kudos
AnonymousDefaul
Enthusiast
Enthusiast

Try the bellow snippet, this should work. I tested and it worked for me.

<folderList>
<folder>
<description>component</description>
<destination>${installdir}/include/foo</destination>
<name>newfolder</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>C:/foo/include/*</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>

0 Kudos
Chris2021
Contributor
Contributor

I had the same question...I wanted to create a more generic installer script that would allow other users to drop applications files into a folder and them package them up without having to make many modifications to the installer script.

One work-around I found was to package all of these files inside a ZIP file and then extract them to the desired destination directory. I have InstallBuilder create this ZIP file for me during the pre-build action. I packaged the ZIP file in the installer and have it going to a temporary folder. Then during the post-installation step I run the unzip action.

Unfortunately, adding "/*" to the end of the path inside of the <origin> tag didn't work for me. That would have been a much more elegant solution.

Best regards,
Chris

0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Chris2021 ,

 

Did you add <allowWildcards>1</allowWildcards> to the <distributionFile>?

<distributionFile>
   ...
  <allowWildcards>1</allowWildcards>
   ...
</distributionFile>

 

0 Kudos
Chris2021
Contributor
Contributor

Thanks @michieldhont_!

I'm pretty sure I did but when I tried it again this morning it worked. Here is what I used:

<folder>
    <description>Install Directory</description>
    <destination>${installdir}</destination>
    <name>install</name>
    <platforms>all</platforms>
    <distributionFileList>
        <distributionFile>
            <allowWildcards>1</allowWildcards>
            <origin>copy to destination/*</origin>
        </distributionFile>
    </distributionFileList>
</folder>


I went back to an older version of my installer script and only difference I could find was that I had been using <distributionDirectory> instead of <distributionFile> but both options are working now. NOTE: I also have <saveRelativePaths> set to 1 so that <origin> resolves to "${build_project_directory}/copy to destination/*"

Thanks for encouraging me to give this another try! This seems to be more reliable then zipping up the files... I was seeing the unzip action fail occasionally if the destination was inside of a Windows UAC protected folder.

Best regards,
Chris

0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Chris2021 ,

I'm glad to hear the issue has been solved.

Regards,

Michiel

0 Kudos