Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List directories with wilcards and nested DirFiles #439

Closed
marcobeninca71 opened this issue Jul 23, 2018 · 6 comments
Closed

List directories with wilcards and nested DirFiles #439

marcobeninca71 opened this issue Jul 23, 2018 · 6 comments

Comments

@marcobeninca71
Copy link

Hi Oleg
this is not a bug but a request and maybe an idea for a new feature.
I'd like to create into the installation directory a variable number of directories reflecting a repository I have on my disc. Then for each directory select all the files which match a specific wild cards. Something like the following

Dirs("c:\temp*machine",
DirFiles("c:\temp*machine*.xml))

Which should mean:

  • go into c:\temp
  • for each directory ending with "machine" take all the file *.xml
  • create the corresponding directory structure into the destination path

What do you think about?

Best regards

Marco

@oleg-shilo
Copy link
Owner

Something like this?

new Project("MyProduct",
    new Dir(@"%ProgramFiles%\MyCompany\MyProduct",
        new DirFiles(@"\\BuildServer\MyProduct\LatestRelease\*.*"),
        new Dir("Docs", 
            new DirFiles(@"\\DocumentationServer\MyProduct\*.chm"),

@marcobeninca71
Copy link
Author

marcobeninca71 commented Jul 26, 2018

I don't really understand your code sorry... maybe it's better not to go into the code. So the matter is the following: can I create a install package with WixSharp which is able to create a folder tree into the installation folder without hard coding all the directories into the package definition? The idea is that if I add a new directory I don't have to modify the code.

For example if I have a repository like

c:\repository\dir1
file1.txt
file2.txt
c:\repository\dir2
file1.txt
file2.txt
c:\repository\dir3
file1.txt
file2.txt
file3.txt

And I want to have the same directory structure into the installation folder I have to write
new Project("MyProduct",
new Dir(@"%ProgramFiles%\MyCompany\MyProduct",
new Dir("dir1",
new DirFiles(@"c:\repository\dir1\.txt")),
new Dir("dir2",
new DirFiles(@"c:\repository\dir2\
.txt")),
new Dir("dir3",
new DirFiles(@"c:\repository\dir3\*.txt")),

And if I add a new directory to repository I have to add new code like
new Dir("dir4",
new DirFiles(@"c:\repository\dir3\*.txt")),

I'd like to automate this maybe with something like
new Project("MyProduct",
new Dir(@"%ProgramFiles%\MyCompany\MyProduct",
new DirDirectories("C:\repository\dir*", "*.txt)",

The first parameter of DirDirectories gives the pattern to match for the directory name and the second the pattern for the files.

Marco

@oleg-shilo
Copy link
Owner

Yes the implements exactly your use case.

The sample is covering the case when the software release is build and the binaries of the solution are aggregated after the build in the dedicated folder. Then WixSharp discovers and includes the all files and the sub-directories into the built MSI:

var project =
    new Project("MyProduct",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new Files(@"..\Release Folder\Release\*.*")
        . . . 

Have a look at the complete "ReleaseFolder" code sample for the details.

@marcobeninca71
Copy link
Author

Ok... thanks
I'll try and let you know
Marco

@marcobeninca71
Copy link
Author

Great Oleg! It works perfectly
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants