Old 20th August 2008, 20:50   #1
Andrew Wallo
Junior Member
 
Join Date: Mar 2008
Posts: 33
rollback.nsh

I'm working on a nice rollback include. ( Aptly titled rollback.nsh ) Just a set of macros really, but it sets up a log that can be saved to a provided path.... builds the log...as you install or edit files and registry entries... and when you're done you close the "session". Then later you could come back and execute the rollback.

Works well for my application which can't really depend on having a clean folder for its files. So 'rollback' means recopying whatever files I detect that I've stepped on, back into the working folder on a rollback. ( Essentially parsing the log file... for FILE entries, and putting it back where the PATH attribute says to go. )

Maybe we should include a log for SQL calls to? Or better a log to execute SQL files against a database... that might abstract your issue better.

It'd be ready for a demo as a general include, except that I'd like to include the ability to tie in a CallBack on a failed copy.... i.e. If you tried to restore a file it was tied up or something. Currently I have a string that gets read from the log file and passed to ExecWait but that's just a bit limiting and somewhat impractical. I'd rather be able to read a string from the log file and call back a function in the NSIS script... like so:

Function handleErrorWithCustomCallback
MessageBox MB_OK "Handled Error."
FunctionEnd

## SNIP ##
## In some Section or function...
ReadFile $myFile $myCallBackString ; blah blah blah
## myCallBackString now has "handleErrorWithCustomCallback"

Call $myCallBackString ; but this isn't resolving....
; macros seem to do something like this with ${_label} but not quite....

The lack of runtime binding/resolution seems to not resolve this.... or maybe I'm not resolving the var's contents like I should be.... any comments Stu?
Andrew Wallo is offline   Reply With Quote
Old 27th April 2011, 16:09   #2
mathrick
Junior Member
 
Join Date: Apr 2011
Posts: 1
Quote:
Originally Posted by Andrew Wallo View Post
I'm working on a nice rollback include. ( Aptly titled rollback.nsh ) Just a set of macros really, but it sets up a log that can be saved to a provided path.... builds the log...as you install or edit files and registry entries... and when you're done you close the "session". Then later you could come back and execute the rollback.
Quote:
It'd be ready for a demo as a general include, except that I'd like to include the ability to tie in a CallBack on a failed copy.... i.e. If you tried to restore a file it was tied up or something. Currently I have a string that gets read from the log file and passed to ExecWait but that's just a bit limiting and somewhat impractical. I'd rather be able to read a string from the log file and call back a function in the NSIS script... like so:

Function handleErrorWithCustomCallback
MessageBox MB_OK "Handled Error."
FunctionEnd

## SNIP ##
## In some Section or function...
ReadFile $myFile $myCallBackString ; blah blah blah
## myCallBackString now has "handleErrorWithCustomCallback"

Call $myCallBackString ; but this isn't resolving....
; macros seem to do something like this with ${_label} but not quite....

The lack of runtime binding/resolution seems to not resolve this.... or maybe I'm not resolving the var's contents like I should be.... any comments Stu?
Any progress on that? I've coded a macro-based semi-solution which allows registering "callback groups", each containing up to 16 callbacks. See callback.nsh for code, and testcallback.nsi for an example of usage. In exchange I'd really like to see your rollback code :)
Attached Files
File Type: nsi testcallback.nsi (891 Bytes, 249 views)
File Type: nsh callback.nsh (10.8 KB, 261 views)
mathrick 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