2
votes

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?

2
Is the actual path that fails also a relative path? - Anders
@Anders Yes, the path that fails is a relative path, and it moves up the the same amount as above - `..\..\..` - davisoa

2 Answers

5
votes

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...

0
votes

I was getting the same error and the complete path was < 260 characters.

Problem

File: failed opening file "\FOLDERSHARE\XYZSRelease\XYZV1.2.2\AutoCompleteMenu.dll" Error in script "C:\TFS\XYZProject\Releases\NullsoftInstaller\XYZWin7Installer.nsi" on line 77 -- aborting creation process

Cause

For some reason when the files are on a Folder Share it doesn't work (I am positive this is a change to the corporate network environment) as it previously was working.

Solution

Put all the files in C:\Temp or another local directory.