Inno Installation Compiler Cannot Find Specified Path with Long Paths

I use the .iss script to create an exe file in the Inno Setup Compiler . I need to pack some node_modules in this application, so I have a line in [Files] that looks like this:

 Source: "{#SourcePath}Encore.Warehouse.UI\bin\Warehouse_Release\warehouse\*"; \ DestDir: "{app}\warehouse"; Flags: ignoreversion recursesubdirs createallsubdirs 

When I compile, I get this error:

The system cannot find the path specified.

Here is the compiler output:

Compiler output

Thus, it works fine until it is interrupted. At first I thought browser.js did not exist, but after double checking it is not. In addition, I use a wildcard in the source path so that the compiler knows that the file exists , but it seems to be having problems compressing it.

Another thing that may be causing the problem is the length of the file path. Node modules usually have a ridiculous file path length due to nested dependencies. In this case, the path length is 260 . Assuming this is causing the problem, is there a way around this?

+10
filepath node-modules inno-setup
source share
1 answer

This is definitely due to a long journey. Typically, Windows applications cannot process paths longer than MAX_PATH (260 characters).
See Filenames, Paths, and Namespaces on MSDN.

The usual workaround is the path prefix with \\?\ (Again, see the MSDN article above). The prefix can only be used for absolute paths. But the Inno Setup compiler suppresses this with the Source attribute. It searches for : and only accepts a path that has a drive letter just before : or uses compiler: or userdocs: prefixes.

You can hack this using a UNC path with a volume identifier (hence without a colon).

Use the mountvol command to find the UNC path for your source disk.

And then you will have the same problem with the long path with the DestDir attribute during installation (not during compilation). There are no colon problems, so you can just use the \\?\ Prefix.

 Source: "\\?\Volume{bb919c3e-bdb1-42b8-9601-6715becd8683}\{#SourcePath}Encore.Warehouse.UI\bin\Warehouse_Release\warehouse\*"; \ DestDir: "\\?\{app}\warehouse"; Flags: ignoreversion recursesubdirs createallsubdirs 

Of course, if the problem is because the root path is already too long, you can solve the problem by simply moving the source files to a folder with a shorter path. Or you can use subst to create a virtual disk, or you can create a symbolic link / directory.

+7
source share

All Articles