Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 4th November 2014, 05:47   #1
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
NSIS installer fails to find existing files while compiling

So I have been trying to build an installer for my game with NSIS. For the most part it works fine but just noticed that it seems to be skipping certain files for no reason. Or no reason I can figure out.

At first I was using this line to gather up all the files in the source folder:

File /r "${NSISDIR}\game\source\*.*"

However, I noticed that this didn't get everything. Granted it found all sub-folders and kept the hierarchy correct. There didn't seem to be any rhyme or reason to what it skipped. Then I tried listing all files and directories separately and found out why. Example:

code:
File "${NSISDIR}\OWTD-DE\source\pygame.math.pyd"


This produces the following error:

code:
File: "C:\Program Files (x86)\NSIS\game\source\pygame.math.pyd" -> no files found.


But that file exists, I can see it in the source folder. This was the case for all missing files. At first I thought it may be the two periods in the name, but various files have that naming convention and they are added fine. I cannot figure out how to get it to recognize these files. Any ideas?
gramps is offline   Reply With Quote
Old 4th November 2014, 12:30   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
By default the 'program files' folder is read only, so first things first, move all the files into a folder with read and write access. Makensis uses the scripts current directory when adding files, so they don't have to be in ${NSISDIR}.

So if your script was in C:\test, using a relative path with the File command like 'File /r "source\*.*"', makensis would recursively look in C:\test\source\*.* for files.

Also, the two lines you posted have different paths.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 4th November 2014, 17:38   #3
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
Hey, thanks for responding. While the two lines do have different paths, I meant to edit the OWTD-DE to game in the first line, but clearly missed it. They both actually have the same paths... sorry for the confusion!

As fro the Program Files path thing, the installer actually pulls in about 30 files and 4 of them give me the "no files found" error, while the other 26 compile fine. I just can't figure out why it decided to skip these four. They exist and are sitting with the others, and their names aren't much different. For instance:

code:
File "${NSISDIR}\game\source\pygame.color.pyd"
File "${NSISDIR}\game\source\pygame.constants.pyd"
File "${NSISDIR}\game\source\pygame.display.pyd"



These are the next three lines and these compile in fine. But my original post has a line that does not.
gramps is offline   Reply With Quote
Old 5th November 2014, 13:22   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
It seems to work fine for me for a non administrator folder (File "${NSISDIR}\game\source\pygame.math.pyd"):

Quote:
...
Changing directory to: "C:\avg"

Processing script file: "C:\avg\test.nsi" (ACP)
Name: "Test"
OutFile: "Test.exe"
ShowInstDetails: Show
Page: InstFiles
Section: ""
SetOutPath: "$EXEDIR"
File: "pygame.math.pyd" [compress] 49 bytes
File: "pygame.color.pyd" [compress] 43 bytes
File: "pygame.constants.pyd" [compress] 49 bytes
File: "pygame.display.pyd" [compress] 49 bytes
SectionEnd

Processed 1 file, writing output (x86-ansi):
...
And for an administrator folder (File "C:\Program Files (x86)\NSIS\game\source\pygame.math.pyd"):

Quote:
...
Changing directory to: "C:\avg"

Processing script file: "C:\avg\test.nsi" (ACP)
Name: "Test"
OutFile: "Test.exe"
ShowInstDetails: Show
Page: InstFiles
Section: ""
SetOutPath: "$EXEDIR"
File: "pygame.math.pyd" [compress] 49 bytes
File: "pygame.color.pyd" [compress] 43 bytes
File: "pygame.constants.pyd" [compress] 49 bytes
File: "pygame.display.pyd" [compress] 49 bytes
SectionEnd

Processed 1 file, writing output (x86-ansi):
...
I got an administrator prompt for every file and folder I created under 'C:\Program Files (x86)'.

Both tests also worked for File /r "*.*"

I install older windows xp style software into it's own 'Program Files XP' folder so that I don't have problems with the user account control, since 'Program Files (x86)' is restricted to administrators.

Check to see if your source files are in the same directory as ${NSISDIR} (!echo "!echo=|${NSISDIR}\game\source|").

Other than your paths somehow being wrong, there's nothing else going wrong on my end. Have you got the 'Hide extensions for known file types' option unchecked under 'Control Panel' ->'Folder Options'->'View'?

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 5th November 2014, 13:32   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,424
You are not supposed to put non-NSIS files anywhere in ${NSISDIR}! There are many reasons why this could be failing, all related to putting source files in Program Files. I don't feel like repeating myself so check my answer on stackoverflow...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th November 2014, 23:45   #6
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
@JasonFriday13
Moved the source files to C: base folder and tried from there. Also checked the folder through Linux, via dual-boot, and there are no weird hidden extensions or permissions going on. Going to try two suggestions from Anders and see what happens. Just odd that it won't compile those four files specifically. At first presume it was permissions on those but nope, they are the same as the others. Will report back.

@Anders
Thanks for the response. Moving the folder out of the NSIS folder didn't make any difference. Still fails on the same four folders for whatever reason. Also responded on Stackoverflow. Thanks for the suggestions!
gramps is offline   Reply With Quote
Old 6th November 2014, 07:05   #7
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
Hmm, sadly those two suggestions did not work.
gramps is offline   Reply With Quote
Old 6th November 2014, 12:21   #8
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Quote:
Originally Posted by gramps View Post
Still fails on the same four folders for whatever reason.
So are these actual file names, or are they directory names?

Type up a basic script that shows the problem and paste it up here. What nsis version are you using btw?

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 6th November 2014, 13:40   #9
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
With mysterious problems like that it often turns out to be something simple you were overlooking, like a typo. Did you try swapping filenames between a file that compiles and one that doesn't; it may tell you if the problem is in the script or file itself.

PostEnd:
aerDNA is offline   Reply With Quote
Old 6th November 2014, 23:35   #10
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
@JasonFriday13 and aerDNA

They are actual file names; Python components. And I am using NSIS version 3.0b1. Here is a simple script I wrote that works fine with the file in question.

code:
; The installation name
Name "Testing"

OutFile "installer.exe"

; The default installation directory
InstallDir $PROGRAMFILES\Game

; Request application privileges for Windows Vista
RequestExecutionLevel admin

; Install components
Page components
Page directory
Page instfiles

; Installing the main game files
Section "Game"
SectionIn RO

; Set output path to the installation directory
SetOutPath $INSTDIR
File C:\Game\pygame.cdrom.pyd

SectionEnd



That makes the installer no problem. So, I started adding in more of the files needed for my installer but NOT modifying the code above. However, when I added the pygame.color.pyd it spit up the error I originally got about pygame.cdrom.pyd not being found. Deleting pygame.color.pyd allowed it to work. Seems like this file alone was the monkey wrench. However, I'm not sure what that means. Even worse, that file is necessary for the game to run.

And again, I checked for permissions, hidden extensions, etc. Oddly, if I swap the code to just compile pygame.cdrom.pyd then it works fine. If I add a second line for pygame.cdrom.pyd it will fail.

Would it make more sense, in this case, to zip up the source files and move those over with the installer then unzip them?
gramps is offline   Reply With Quote
Old 7th November 2014, 11:10   #11
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Duplicates should be referenced, not spit out errors:
Quote:
Changing directory to: "C:\avg"

Processing script file: "C:\avg\test.nsi" (ACP)
Name: "Testing"
OutFile: "installer.exe"
InstallDir: "$EXEDIR\Game"
Page: components
Page: directory
Page: instfiles
Section: "Game"
SectionIn: [RO]
SetOutPath: "$INSTDIR"
File: "avg_free_x64_all_2015_5557a8402.exe" [compress] 173965123/174022504 bytes
File: "avg_free_x64_all_2015_5557a8402.exe" [compress] 0/174022504 bytes
File: "avg_free_x64_all_2015_5557a8402.exe" [compress] 0/174022504 bytes
SectionEnd

Processed 1 file, writing output (x86-ansi):
Processing pages... Done!
Removing unused resources... Done!
Generating language tables... Done!

Output: "C:\avg\installer.exe"
Install: 3 pages (192 bytes), 1 section (2072 bytes), 5 instructions (140 bytes), 50 strings (1129 bytes), 1 language table (250 bytes).
Datablock optimizer saved 339775 KiB (~66.6%).

Using zlib compression.

EXE header size: 35840 / 35840 bytes
Install code: 992 / 3151 bytes
Install data: 173965127 / 522067524 bytes
CRC (0xC72664AF): 4 / 4 bytes

Total size: 174001963 / 522106519 bytes (33.3%)
Something is going on with your setup, it could very well be a typo.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 7th November 2014, 15:19   #12
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
If you use File C:\Game\*.pyd, do all .pyd get included?

PostEnd:
aerDNA is offline   Reply With Quote
Old 7th November 2014, 18:52   #13
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,424
Without a Process Monitor trace all we can do is guess. It could be a bug in NSIS3, have you tried 2.46? It could be a problem with your machine or you could have typed a path wrong, there is no way for us to know.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th November 2014, 01:59   #14
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
@JasonFriday13
I had considered typos but having the system print me a list of all files and using that seems unlikely there would be. And again, it skips the files if certain others are there. However, if I just use a basic copy from x to y command instead of compiling, it gets everything.

@aerDNA
If I do that then all but four files get compiled, basically the same problem.

@Anders
Yeah, I have no idea what is going on. I think I will try the previous version of NSIS and try that.
gramps is offline   Reply With Quote
Old 9th November 2014, 14:39   #15
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
See what happens if files are pulled from a fat32 usb, and/or try compiling on another machine.

PostEnd:
aerDNA is offline   Reply With Quote
Old 16th November 2014, 20:51   #16
gramps
Junior Member
 
Join Date: Nov 2014
Posts: 7
Finally got it accept all the files with no errors by trying it out on Windows Pro 64-bit. For whatever reason it was not as happy on Windows Home 64-bit. Oh well, probably solved.
gramps is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump