logo
down
shadow

Find a directory using wildcard in Inno Setup


Find a directory using wildcard in Inno Setup

By : Yanliom
Date : November 22 2020, 04:01 AM
I wish this helpful for you You can define an Inno Setup preprocessor function that will resolve the directory file mask. Use FindFirst function for that:
code :
#define FindFolder(Path) \
    Local[0] = FindFirst(Path, faDirectory), \
    Local[0] ? AddBackslash(ExtractFileDir(Path)) + FindGetFileName(Local[0]) : Path

[Files]
Source: "{#FindFolder("..\packages\PackagesA*")}\*.*"; DestDir: "{app}"; \
    flags: recursesubdirs  
#expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")
[Files]
Source: "..\packages\PackageA1.2.0\*.*"; DestDir: "{app}"; flags: recursesubdirs  
[Files]
Source: "..\packages\PackageA*\*.*"; DestDir: "{app}"; flags: recursesubdirs  


Share : facebook icon twitter icon
Inno Setup - FileCopy use wildcard character in pathname

Inno Setup - FileCopy use wildcard character in pathname


By : Azed Bouchibi
Date : March 29 2020, 07:55 AM
Hope that helps You need to use FindFirst, FindNext, and FindClose to iterate through the folder. You get each database name, and then copy it individually. An example of doing that in Pascal (Delphi) can be found here. There's also an example of using them in the InnoSetup help file, in the Support Functions Reference section on File System Functions:
code :
// This example counts all of the files (not folders) in the System directory.
var
  FilesFound: Integer;
  FindRec: TFindRec;
begin
  FilesFound := 0;
  if FindFirst(ExpandConstant('{sys}\*'), FindRec) then begin
    try
      repeat
        // Don't count directories
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
          FilesFound := FilesFound + 1;
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;
  MsgBox(IntToStr(FilesFound) + ' files found in the System directory.',
    mbInformation, MB_OK);
end;
Inno Setup - Integer or Set/Range wildcard?

Inno Setup - Integer or Set/Range wildcard?


By : jasonrest
Date : March 29 2020, 07:55 AM
this one helps. The @TLama's FileExistsWildcard function internally uses Inno Setup FindFirst function, which in turn internally uses Windows FindFirstFile function.
And Windows supports only * and ? in its wildcards. The range/set pattern [a-z] is *nix thing only.
code :
function MatchesMaskEx(Mask: string; FileName: string): Boolean;
var
  MaskI: Integer;
  MaskC: Char;
  FileNameI: Integer;
  FileNameI2: Integer;
  P: Integer;
  Mask2: string;
  EOSMatched: Boolean;
begin
  Mask := LowerCase(Mask);
  FileName := LowerCase(FileName);

  MaskI := 1;
  FileNameI := 1;
  Result := True;
  EOSMatched := False;

  while (MaskI <= Length(Mask)) and Result do
  begin
    MaskC := Mask[MaskI];

    if MaskC = '?' then
    begin
      { noop, ? matches anything, even beyond end-of-string }
      Inc(FileNameI);
    end
      else
    if MaskC = '[' then
    begin
      if FileNameI > Length(FileName) then
      begin
        Result := False;
      end
        else
      begin
        P := Pos(']', Copy(Mask, MaskI + 1, Length(Mask) - MaskI));

        if  P = 0 then
        begin
          { unclosed set - no match }
          Result := False;
        end
          else
        begin
          Result := False;
          P := P + MaskI;
          Inc(MaskI);
          while (MaskI < P) and (not Result) do
          begin
            MaskC := Mask[MaskI];
            { is it range (A-Z) ? }
            if (MaskI + 2 < P) and (Mask[MaskI + 1] = '-') then
            begin
              MaskI := MaskI + 2;
            end;

            { matching the range (or pseudo range A-A) }
            if (MaskC <= FileName[FileNameI]) and
               (FileName[FileNameI] <= Mask[MaskI]) then
            begin
              Inc(FileNameI);
              Result := True;
              MaskI := P - 1;
            end;
            Inc(MaskI);
          end;
        end;
      end;
    end
      else
    if MaskC = '*' then
    begin
      Mask2 := Copy(Mask, MaskI + 1, Length(Mask) - MaskI);
      Result := False;
      { Find if the rest of the mask can match any remaining part }
      { of the filename => recursion }
      for FileNameI2 := FileNameI to Length(FileName) + 1 do
      begin
        if MatchesMaskEx(
             Mask2, Copy(FileName, FileNameI2, Length(FileName) - FileNameI2 + 1)) then
        begin
          Result := True;
          MaskI := Length(Mask);
          FileNameI := Length(FileName) + 1;
          break;
        end;
      end;
    end
      else
    begin
      if (FileNameI <= Length(FileName)) and (FileName[FileNameI] = MaskC) then
      begin
        Inc(FileNameI);
      end
        else
      begin
        { The dot can match EOS too, but only once }
        if (MaskC = '.') and (FileNameI > Length(FileName)) and (not EOSMatched) then
        begin
          EOSMatched := True;
        end
          else
        begin
          Result := False;
        end;
      end;
    end;

    Inc(MaskI);
  end;

  if Result and (FileNameI <= Length(FileName)) then
  begin
    Result := False;
  end;
end;
function FileExistsEx(Path: string): Boolean;
var
  FindRec: TFindRec;
  Mask: string;
begin
  if FindFirst(AddBackslash(ExtractFilePath(Path)) + '*', FindRec) then
  begin
    Mask := ExtractFileName(Path);
    try
      repeat
        if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0) and
           MatchesMaskEx(Mask, FindRec.Name) then
        begin
          Result := True;
          Exit;
        end;
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;

  Result := False;
end;
function SpecialFileExists(Path: string): Boolean;
var
  FindRec: TFindRec;
begin
  if FindFirst(AddBackslash(Path) + '*', FindRec) then
  begin
    try
      repeat
        if (Length(FindRec.Name) = 4) and
           (Copy(FindRec.Name, 1, 3) = 'sav') and
           (FindRec.Name[4] >= '0') and (FindRec.Name[4] <= '9') then
        begin
          Result := True;
          Exit;
        end;
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;

  Result := False;
end;
SpecialFileExists(ExpandConstant('{app}'))
My program stop when it saves files on the directory (inside the app directory) after creating the setup by inno setup C

My program stop when it saves files on the directory (inside the app directory) after creating the setup by inno setup C


By : Siddharth Singh
Date : March 29 2020, 07:55 AM
this will help Directory.GetCurrentDirectory() + "\Fichiers"
This is a very unreliable function to set a path to a directory. Without testing, the application can work in a different directory at the time you are asking for GetCurrentDirectory().
code :
[Dirs]
Name: "{app}\bin"
Name: "{app}\bin\debug"
Name: "{app}\bin\debug\Fichiers"
 try 
     {
      // Set the current directory.
      string target = Application.StartupPath + "\\bin\\debug\\Fichiers";
      if (!Directory.Exists(target)) 
         {
           Directory.CreateDirectory(target);
         }
            // Change the current directory.
            Environment.CurrentDirectory = (target);
     ..............
[Code]
var
excelPath : String;

..............
excelPath := ExpandConstant('{app}\bin\debug\Fichiers');
Find the path of an application, and copy a file to that directory in Inno Setup

Find the path of an application, and copy a file to that directory in Inno Setup


By : akamouch
Date : March 29 2020, 07:55 AM
Hope this helps The where command searches the file in the path specified by the PATH environment variable.
In Inno Setup Pascal Script, you can implement that using FileSearch function, like:
code :
FileSearch('matlab.exe', GetEnv('PATH'))
[Files]
Source: "MyFile.dat"; DestDir: "{code:GetMatlabToolboxLocalPath}"

[Code]

var
  MatlabToolboxLocalPath: string;

function GetMatlabToolboxLocalPath(Param: string): string;
begin
  Result := MatlabToolboxLocalPath;
end;

function InitializeSetup(): Boolean;
var
  MatlabExePath: string;
begin
  MatlabExePath := FileSearch('matlab.exe', GetEnv('PATH'));
  if MatlabExePath = '' then
  begin
    MsgBox('Cannot find MATLAB', mbError, MB_OK);
    Result := False;
    Exit;
  end;

  MatlabToolboxLocalPath := ExtractFilePath(MatlabExePath) + '..\toolbox\local';

  Result := True;
end;
How to recursivelly include folder/files using a wildcard in Inno Setup

How to recursivelly include folder/files using a wildcard in Inno Setup


By : yeshaya
Date : March 29 2020, 07:55 AM
I wish this help you 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:
Related Posts Related Posts :
  • OpenFlow Rule Metadata
  • Input Capture mapping using PPS
  • What does the "R + 'static" syntax mean in "F: FnOnce(&mut Resource<S>) -> R + 'static"
  • Google Cloud authorization keeps failing with Python 3 - Type is None, expected one of ('authorized_user', 'service_acco
  • Service Fabric Stateless api certification based authentication
  • How do I use ranges with Presto DB
  • Bootstrap4 - cards and grid together?
  • JFrame does not show anything
  • Database.getQueryLocator return wrong data
  • SonarQube/ SonarCloud - Is there an option in SonarQube Web Interface (UI) to display analysis per commit basis?
  • Azure Application Gateway exit IPs
  • Aqueduct controller subrouting
  • Location filter tweepy module
  • EntityFramework.SqlServer missing in release mode
  • RefreshDatabase is extremly slow
  • Does every record in a Flink EventTime application need a timestamp?
  • Convert first lowercase to uppercase and uppercase to lowercase (regex?)
  • Text analytics returns 404 'Resource not found'
  • ML version of anonymous map inside let?
  • C++ builder How to access a specific cell in a DrawGrid
  • Correct Data Protection Declaration
  • Express.js can't display images from directory 'images' with express.static
  • Drupal 8 getting empty $_GET variable
  • Cross-compiling boost 1.69.0 for ARM
  • xarray apply_ufunc to get the min and max for every variable
  • Descend JSON doc paths and update field names with jq
  • Specifying multiple/wild card reply urls in Azure AD B2C
  • How to prevent Query of Queries returning case sensitive results from CFC in Coldfusion
  • Days as a time series?
  • Deleting ALL existing users from a list of Distribution Lists via powershell , Exhcange 2010
  • Filtering data using constraints in Datastage Transformer
  • Newline in block name
  • What is the difference between &Trait and impl Trait when used as method arguments?
  • Extending Repeater (or other widget with nested XML tag attributes)
  • servicestack null ref error when using native SQL and ORMLite. Dapper error
  • How to check if file exists in Eiffel
  • How To Pick Out Activity inbetween phrases in DialogFlow
  • How to check if IOTA is receiving data from device
  • How to get a link to a gitlab comment (inside a merge reqeust) that I wrote?
  • Code: 0x80073CFB downloading my own app from Microsoft Store
  • Processing get higher max frameRate
  • Redefining operator precedence in a module for exported predicate
  • Building an OpenAPI response, including oneOf, and maybe allOf
  • Counting number of files in a directory with Nifi
  • Chartjs Overlap click function doesnt work
  • Download macOS Mojave in windows 10 virtualbox
  • Dynamics Web Resource opening a dynamic window
  • How do I launch Spyder-Notebook?
  • p4 integrate/merge between depots
  • cannot quote my message on slack app for windows with >>>
  • How to fix app go to background after reorder to front and back
  • How can I save multiple pages of the PDF version of an Acumatica report to a file programmatically?
  • How to update the Frame's schema after Map.apply operation?
  • ECMA6 classes not working on IE11 with Webpack and Babel
  • QGIS - cannot change CRS of shapefile
  • snmpd.conf clientaddr not working for sending trap /inform with given IP source address
  • Should a DICOM StudyInstanceUID be unique to the patient?
  • org.apache.flink.client.program.ProgramInvocationException: Could not retrieve the execution result
  • Does iText 7 PdfReader support partial reading?
  • Gensim doc2vec file stream training worse performance
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org