Old 12th January 2004, 03:54   #1
gbeardsl
Junior Member
 
Join Date: Jan 2004
Posts: 10
Locked file handling?

Kind folk,
During any installation, it's best to assume that the files you're installing may already be present on the target system, and may be locked.

To properly handle this condition, I'm using the "Rename" function with the "/REBOOTOK" option. This appears to be the only method within NSIS for handling locked file conditions. Using this method will set the reboot flag if the target file is currently locked.

The error that I'm experiencing is that if the file is present on the user system at all, then the reboot flag get's set, even if the file is not locked.

I've put many days into using the NSIS installer, and so hate to revert to InstallShield. However, if locked files can't be properly handled, I may have no choice.

This is a really common need; does anybody know of this bug, how to work around, or what is considered proper protocol in NSIS for handling locked files?

I'm using version 1.98 for a variety of reasons.

Thanks so much!
I'm desperate,
Gary
gbeardsl is offline   Reply With Quote
Old 12th January 2004, 07:38   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
There are many known bugs in the old 1.98 version you are using, it has not been updated for two years.

Upgrade to NSIS 2 and it should work fine.
Joost Verburg is offline   Reply With Quote
Old 12th January 2004, 07:50   #3
gbeardsl
Junior Member
 
Join Date: Jan 2004
Posts: 10
Thanks Joost. After reading some of the other related topics, I may choose to be lazy for the moment and simply delete it first with /REBOOTOK. If it's locked, the reboot flag will be set. If it's not locked, then Rename will do the deed without the failure.

But again, Thanks!
gbeardsl is offline   Reply With Quote
Old 12th January 2004, 15:26   #4
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Almost all NSIS 2 features are backwards compatible, upgrading is highly recommended because it will fix several issues.
Joost Verburg is offline   Reply With Quote
Old 12th January 2004, 17:27   #5
gbeardsl
Junior Member
 
Join Date: Jan 2004
Posts: 10
Point taken. However, I must ship today, and QA time is insufficient to gamble on any other failures. The delete fix works, so it's going out the door. Will use new version next build.

Thanks,
Gary
gbeardsl is offline   Reply With Quote
Old 26th January 2004, 20:37   #6
gbeardsl
Junior Member
 
Join Date: Jan 2004
Posts: 10
Joost,
Thanks for your communications and work on this codebase! Per your suggestion, I did of course update to the latest version of NSIS.

I need to ask about the current methodology for handling locked files. The support for this is still pretty convoluted if I understand it correctly. There's a high percentage of the files that I install which could potentially be locked, and realistically, I always assume any file could be locked when building an InstallShield installer. It's simply good practice and eliminates error.

For installing potentially locked files with NSIS, I cannot merely use the 'File' command. I must first unpack the files in a temp folder, then use 'Rename' to move it to the target, then check the error flag and manually set the reboot flag which I will check at the end of install to see if I should reboot.

This seems to be the only current approach; is this correct? It would certainly be nice if this functionality was all contained in the 'File' command with a 'Locked' flag. I've considered adding this myself, but am new to NSIS and don't want to start screwing with source if this effort is already underway by somebody and until I'm hooked for sure.

Any comments you have would be appreciated.

Thanks!
Gary
gbeardsl is offline   Reply With Quote
Old 26th January 2004, 22:07   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
There is no other method. InstallShield will have to do the same thing.

You can put the code in a macro it you need to use it multiple times.

The included UpgradeDLL macro handles version checks and upgrades.
Joost Verburg is offline   Reply With Quote
Old 26th January 2004, 22:50   #8
gbeardsl
Junior Member
 
Join Date: Jan 2004
Posts: 10
Thanks Joost! I will check the "included UpgradeDLL macro".

FYI - InstallShield must do this also of course, but all the user does is click a checkbox for "potentially locked".

gb
gbeardsl 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