NSIS doesn't backup all files - backup

An NSIS installer creates a fairly large folder structure. When the installer starts, it checks the registry to see if there is a current version installed...
Then it asks if you want to make a backup of the current folder.
It works most of the time, but sometimes when it is backing up older versions, instead of copying over the entire directory, it only copies the icon.
!insertmacro un.MoveFolder "$INSTDIR" "${BACKUP_FOLDER}" "*.*"
Reference: http://nsis.sourceforge.net/MoveFileFolder
!insertmacro MoveFolder "$INSTDIR\[path\]source-folder[\]" "$INSTDIR\[path\]destination-folder[\]" "file-mask"
Afterwards, it moves on to the delete section...
Could it be that it doesn't have time to do it ? it starts the next process before finishing the move ?
What else could be going on so that it does not copy the entire folder ?
During the installer, I see
Create folder c:\backup_folder
Moving files: c:\current_folder\*.* to c:\backup_folder\
Delete file: c:\current_folder\file1.........
And at the end, backup_folder has only the icon (not all the files)
Edit: The solution - please see my post here NSIS difficulty moving folders - $INSTDIR is indeed a special folder so I had to move the uninstaller to a $TEMP folder.

Is there any reason why you cannot use the built-in CopyFiles command?
To debug this I would suggest that you add a DetailPrint near the top of the .MoveFolder_Locate_moveFile function. If you see all the file names go by then the problem is the move operation in that function, if not then the problem is in the ${Locate} macro used by this code.
Another alternative is to watch the filesystem operations with Process Monitor...

Related

PhpStorm Search Everywhere is not working, do you know the solution?

I don't know this is off topic or not, I'm using general channels. Is there a solution for Search Anywhere in PhpStorm. I work with Laravel but when I use the feature I can't find the file even though it exists.
Looking at your screenshot: based on the fact that ALL files in the project tree have that sort of "dirty yellow" background color... it looks like ALL of your files are considered excluded / outside of the project for some reason.
Most likely a user error of some kind. E.g. you may have opened it from a different path (i.e. when symlink is involved), may have c=misconfigured it later somehow (marked folder as Excluded by mistake or whatnot) or maybe even some sort of config file corruption (pretty unlikely).
Anyway, please do this:
Close your project
Go to the project root folder and delete your .idea subfolder (that's where your project settings are stored).
If you have that project still visible in the IDE (Recent Projects on the Welcome screen) -- you may remove it there as well (to avoid any possible confusion).
Now create a new project in PhpStorm from scratch using existing files: just use "Open" and point to the folder with your project.
Please check filter option. If you are doing file search then click on Files tab.

Is there a built in way to hide a file in Wix?

The company I work for has recently taken to generating MSI files with Wix. We're at the tail end of the process, but there's one more thing they need me to do.
We have an XML file with a snapshot of what binaries have gone into the install. However, the customers we deliver to will get somewhat confused about an extra useless file in the install.
Most everything that comes up when I search for 'Wix' and 'hide file' is focused on removing or deleting the files after install. I just need to hide this sucker though.
Is there a way to hide the file through HEAT or something? I can modify the file element in the WXS using XSL or Powershell if need be. Or do I need to resort to a custom action that calls cmd.exe to hide it?
You can try setting the file element's hidden attribute to yes. Taken from here:
Set to yes in order to have the file's hidden attribute set when it is installed on the target machine.

Embedding an image as a resource in a FireBreath plugin

While using VS (2010), I used to be able to add an image as a resource simply by going to the Resource view and then: Right click project > Add > Resource > Import.
I even asked a question about how to then load it: Loading an image from a resource embedded in a dll, but that changed for some reason.
Now when I try the same thing and save the .rc file, I get this message:
"The resource script FILE_PATH.rc was not created using Microsoft
Visual Studio. Comments, macros, preprocessor directives, and
conditionally included information may be modified and/or removed from
this file during the build process. Replace existing file?"
Even if I click "yes" (in order to just test things) then I get all kind of error messages at compile time:
ResourceCompile:
gen\firebreathWin.rc(8): error RC2144: PRIMARY
LANGUAGE ID not a number
gen\firebreathWin.rc(16): error RC2135: file not found VS_VERSION_INFO
etc...
I have two questions:
What is the correct way to add an image resource which will be added to the compiled plugin using CMake? I searched about it and couldn't find any helping information.
What can be the cause for this change in behavior? since I was able to use the same exact steps before and it worked.
Thanks.
First of all, I wouldn't do this; instead, I'd just put the file in the same directory as your DLL and use the path of DLL to find it.
That said, the "correct" way to do this would be to see what changes are made to the .rc file when you add it in the IDE, copy the .rc file from gen_templates/ in the root of the firebreath directory into your project, and then make those changes to your copy of the file. Any changes you make to the generated file will be overridden any time cmake is run again, which can happen any time your cmake files (CMakeLists.txt, *.cmake) change.

Wix Copyfile and components order

I'd like to move some files from where the directory is installed to a second location with a MSI.
I created a component that refers to the second directory and added there the CopyFile element:
<CopyFile Id="copy" DestinationProperty="AUSTORAGE" SourceProperty="PFSTORAGE" SourceName="*.*" Delete="yes" />
It doesn't seem to copy anything but after taking a look at the logs its seems like the component that copy the files is executed before the files are copied to the first directory during the installation.
Is there any way to control the secuence of the components? Or any better aproach to copy the files (all the files in a directory)?
Just move your CopyFile element under the File element (the file you'd like to copy after it is installed), and it will appear in the right order. The point here is the DuplicateFile table functionality (the one Ciprian mentions here) is also included into the CopyFile element logic. See CopyFile element help for more details.
You cannot use a CopyFile operation because the MoveFiles action (which copies the files) comes before the InstallFiles action durring install.
Please take look at the DuplicateFile table which will copy files after the files are deployed.
http://msdn.microsoft.com/en-us/library/aa368335(VS.85).aspx

Copy files from Setup location to installation dir

I am working on my Wix project and have 2 questions:
1) How can I copy file from the same location as my .msi is to the destination folder specified during installation. This file is not part of .msi package but a customized file that needs to be copied after the installer copies the main code files.
2) If this customized file is not available at the location where .msi file is, then I need to show up a OpenFile Dialog so that user can specify the location of this file.
In short, by default the installer should look for the customized file at the same location where the installer is and if the file is not available then show OpenFile Dialog.
Any suggestion or sample code snippet would be very helpful as I am bit new to WIX world.
Thanks for your time.
Ok, first thing you should find out if the file is there. Use DirectorySearch/FileSearch elements for this.
Next, based on the file search result (it will end up in a certain property) schedule and condition a new dialog. You can find how to customize your dialog UI sequence here.
And finally, use CopyFile element to do the copy work.