Search code examples
nsis

Error opening file during Installer Compilation


While running a script to create an NSIS installer, I'm getting an error I can't figure out. The script copies the files needed to create the installer, and then calls makensis to build the setup.exe.

During the compilation with makensis, I get an error while trying to include a directory structure that was copied before makensis was called.

The error is: File: failed opening file "..\..\..\My\Long\Path\Name\To\File.ext"

It fails reliably on a specific file that is 5 directories deep from the File /r command used to include the directory structure. The total path length is 180 characters, so it is not insanely long.

This error persists even after reboots or deleting and recreating the entire directory structure. To make it even worse, it works fine on another machine.

I've used Process Monitor to watch the usage of the files in the directory, and there isn't anything that is opening the file after the copy completes.

Any idea how to solve this problem?


Solution

  • The complete path (Current directory + relative path) has to be < 260 characters.

    Are you sure your Process Monitor filters are correct, there should be some type of action taken that then fails? The "File: failed opening file" message is printed if CreateFile fails...