|
|
#1 |
|
Junior Member
Join Date: Feb 2008
Location: The Netherlands
Posts: 5
|
Summary of files in use
I want to switch from InstallShield to NSIS, but I have one problem;
With InstallShield it is possible to check witch files are in use en show them (see attachment). I know I can do this also in NSIS with the following code: Push $R0 ClearErrors FileOpen $R0 "file.ext" r FileClose $R0 IfErrors 0 +2 DetailPrint "file.ext is locked!" Pop $R0 But with this piece of code I have to specify every single file. Because the monthly update of our program contains every time much updated, but also new files, I want to check for locked files by specifying only the installdir. Likewise how I install them: SetOutPath $INSTDIR File /r "muchfiles\*.*" How can I make this possible? |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Use the LockedList plug-in for an advanced solution, otherwise you can attempt to rename the files which will result in the error flag being set.
Stu |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2008
Location: The Netherlands
Posts: 5
|
I almost have what I want. But for some reason my ErrorFlag is set also when no files are in use. What is wrong?
To test the code below change the INSTDIR in the MAIN section. code: |
|
|
|
|
|
#4 | |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Quote:
code: You clear the errors, then you go to the Next label. This runs the code: code: If no further file is found, the error flag is set. ( "the search is completed (there are no more files), filename_output is set to empty, and the error flag is set." ) You check for this empty string after the Loop tag: code: And jump to the Done tag, which is followed by a check for Errors. code: Whoops?
|
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2008
Location: The Netherlands
Posts: 5
|
Thanks I've got it working now.
Now my function checks if all files in my instdir are writable, but I only need to know if only the files I want to overwrite are writable. I have searched the forum, examples and plugins, but I cannot find out how to know what files I have packed. In short; I want to know what files I'm gonna extract, and before I extract the whole bunch, I want to check if the already existed files are writable. Not all files in instdir, but only the ones I want to overwrite. |
|
|
|
|
|
#6 | ||
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Quote:
![]() Quote:
A. hard-code this in your installer (or in an external file) B. generate your installer (or aforementioned external file) using another installer or a batch file you'd write that essentially creates the list for you, that you would execute before compiling your installer. (This, iirc, is what is usually recommended). ( http://blogs.oracle.com/duffblog/2006/12/12 ) C. extract your files to a temporary folder first, then use the usual FindFirst etc. to get their filenames. ( you could, later on, use delete+rename to prevent having to extract the files again ) D. try installing the files anyway, now get the installation log file, find out which files failed, and prompt the user about these and try installing again. (or any of many variants on this) There's probably other methods.. B tends to be the one that gets recommended. |
||
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Feb 2008
Location: The Netherlands
Posts: 5
|
Thanks man, I finally got what I want!
![]() Some code sharing... My setup.nsi: And here my CreateHeader.nsi (need to be compiled before compiling the setup):code: And here a piece of the generated Header.nsh:code: code: Last edited by Barkruk; 8th February 2008 at 17:08. |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Feb 2008
Location: The Netherlands
Posts: 5
|
And see the differences from the attached file and the attached file from the start-post
|
|
|
|
|
|
#9 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
et voila
Glad it worked out for you! NSIS can be a little daunting at first, but once you figure these types of things out, there's very little reason to even ponder an alternative anymore.
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|