4

I want to include language resource files from our build into our installers. The language resource files all have the same name, but reside in different sub-folders (one per locale), like this:

\Release
  \bin
    \es-MX
      Localization.resources.dll
    \fr-CA
      Localization.resources.dll
etc.

In my [Files] section, I thought perhaps I might be able to do this (note the position of the asterisk):

Source: "..\\source\\Libraries\\Localization\\bin\\Release\\*\\Localization.resources.dll"; \
    DestDir: "{app}\\MyApp"; Flags: ignoreversion recursesubdirs

Unfortunately, Inno Setup blows up, complaining that it can't find any files:

Compiler Error!
Line 129: No files found matching "C:\Development\HT\Installers\..\source\Libraries\Localization\bin\Release\*\Localization.resources.dll"

I would like Inno Setup to look for any sub-folder (hence the *) containing a file named Localization.resources.dll and upon installation, create a language directory with the same name (based on what is found via the wildcard) and copy the file to that folder, doing so for each folder that matches the criteria.

Essentially, I want to end up with this:

..
  \MyApp
    \es-MX
      Localization.resources.dll
    \fr-CA
      Localization.resources.dll

In case it isn't obvious, I would prefer not to explicitly add the source and destination folder names, because we will be adding more languages/locales in the future, and I would like Inno Setup to automatically pick up any new language folders/files we create without having to change the installer source.

Is this possible?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Dennis Jones
  • 211
  • 2
  • 13
  • You need `createallsubdirs recursesubdirs` Flags. E.g.: `Source: "C:\SourceDir\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs` – RobeN Dec 02 '16 at 22:19
  • Thanks, but I don't want *all* sub-folders to be included and copied to the destination -- only sub-folders that match the criteria (containing a file with the specified name). There are many sub-folders in the source path that I don't want included. – Dennis Jones Dec 02 '16 at 23:44
  • I've worked around the problem by grabbing the required files from a different location that only has the language resource folders and then using '*' to get everything from that location instead. – Dennis Jones Dec 03 '16 at 00:26

1 Answers1

2

Just use the recursesubdirs flag with a root path to a tree and the Localization.resources.dll filename. It will automatically do what you want: find all Localization.resources.dll files in the tree and install them to their respective subfolders:

Source: "..\source\Libraries\Localization\bin\Release\Localization.resources.dll"; \
    DestDir: "{app}\MyApp"; Flags: ignoreversion recursesubdirs

As documented (emphasis mine):

recursesubdirs

Instructs the compiler or Setup to also search for the Source filename/wildcard in subdirectories under the Source directory.


Other possible approaches:

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992