Archive: Different folders, same filenames, different files!


Different folders, same filenames, different files!
OK, I've been having a problem - I'm trying to create an installer for a Torque game I am working on, however, I've run into some problems.

-I need to include two folders, a "common" folder, and a folder containing the data for my game.

-There are files named the same in each folder, but they are not the same file! NSIS, however, treats them the same.

-I need a way to automate it or use wildcards. There are many files at different levels of the hierarchy.

Example:


SetOutPath "$INSTDIR\common"
File /r "*.dso"

SetOutPath "$INSTDIR\Data"
File /r "*.dso"


If I have two "main.dso" - one in common and one in Data, it will only use one and not the other :(. This is not the behavior I want.

There's an instruction to stop NSIS from not including a second file if it has the same name as a previously compressed one, but I can't find it in the docs.

-Stu


Oh well. I was hoping for an answer, but I guess I'll have to create my own software to automatically create the NSIS script. It's not the best way, but it appears to be the only way :(.


Maybe NSIS could check this automatically:

Include all files only once which have the same content (check this on compile time). Add filename (and attributes) to this file content for each occurence of "File".

So files with same name and different content wouldn't be a problem, files with possibly different name and same content, neither.

Just an idea for some future NSIS release. :)

PS: The check for equal files could calculate CRC32 first, sort the file table and then compare byte-by-byte files with same CRC32 (just to be sure).


NSIS already includes the content of identical files only once.


Yeah, but in my case they are not identical files! They only happen to have the same filename, and are located in different folders :(.


In your case, NSIS did what you told it to. You told it to include all the files under the current directory which have the extension of .dso twice. What you probably want to do is:

SetOutPath $INSTDIR\common
File /r common\*.dso
SetOutPath $INSTDIR\Data
File /r Data\*.dso

Got it to work, thanks!