Patches item #1051250, was opened at 2004-10-21 07:20
Message generated for change (Comment added) made by kichik
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=373087&aid=1051250&group_id=22049
Category: NSIS
Group: Unstable
Status: Closed
Resolution: None
Priority: 5
Submitted By: Kenneth Davis (perditionc)
Assigned to: Amir Szekely (kichik)
Summary: add !insertfilemacro command
Initial Comment:
A new command that combines features of insertmacro
and the File command, such that it will insert one of
three macros based on a file specification passed at
compile time. It will optionally recurse and inserts
one macro if a file found (passing the filename and any
optional macro parameters), or one of other two macros
on entry or exit to a subdirectory.
I'm not sure of a proper command name and not tied
to !insertfilemacro, but that is what this patch uses.
Included in patch is code for this macro, combination
of shared code between insertfilemacro and insertmacro
command, and updates to the documentation file for it.
[Patch is against last Saturday's snapshot.]
Also available at
http://www.darklogic.org/win32/nsis/nsis20.insertfilemacro/
is the patch and a complete archive of the snapshot with
patch applied and two sample test installers.
I can provide the example installers separately if needed
and possibility make any other suggested changes.
I would appreciate if you would consider this. It provides
a work around for at least one bug (the skip files for
File command via !insertfilemacro /skip:filespeclist
option)
and allows me to update the AbiWord installer to insert
a macro for each file installed without running an
external program to generate NSIS commands.
I have tried to test it for accuraccy, but as I am not
familiar with nsis code, there may still be some bugs.
Thank you,
Jeremy Davis
jeremyd [at] fdos.org or computer.org
----------------------------------------------------------------------
>Comment By: Amir Szekely (kichik)
Date: 2004-11-27 23:01
Message:
Logged In: YES
user_id=584402
There aren't any firm plans for the plug-in system yet.
Currently, the plan is to refactor some more to make it
easier to create it and make it as extensive as possible. I
am, however, considering an intermediate solution for this
specific case as it is a widely requested feature. If you
want to help, I can use more ideas and some refactoring patches.
Thanks.
----------------------------------------------------------------------
Comment By: Kenneth Davis (perditionc)
Date: 2004-11-27 07:48
Message:
Logged In: YES
user_id=164681
Sounds reasonable, I'm going to go ahead and close this then.
:-)
Are there any plans yet for the plugin system or anything I
can do to help?
----------------------------------------------------------------------
Comment By: Amir Szekely (kichik)
Date: 2004-11-26 20:33
Message:
Logged In: YES
user_id=584402
I am aware of the main goal, but I just don't think this
file macro is the best way to achieve this. The optimal
solution I am aiming at is compiler plug-ins. Not only in C
but also Python or even embedded LUA.
----------------------------------------------------------------------
Comment By: Kenneth Davis (perditionc)
Date: 2004-11-26 20:19
Message:
Logged In: YES
user_id=164681
The new exclude feature is cool. The primary reason for
this patch though wasn't the skip files support, the macro
on directory/file recursion is to simplify logging for
uninstallation and updates. Think of uninstall particular
files as discussed in
http://forums.winamp.com/showthread.php?s=56ace370fd7c64aa57747b909cd9c725&threadid=199750
but with support for logging subdirectories (so even empty
ones will be removed) and recursing into them (without need
to explicity specify files contained within, similar to the
/R option). In particular, a macro can be written such as:
!macro addFile FileName
File "${FileName}"
FileWrite $UninstLog "FILE: $OUTDIR\$\r\"
!macroend
!macro dirEnter dirName
push $R0
StrCpy $R0 "$R0${dirName}
SetOutPath $R0
FileWrite $UninstLog "DIR: $R0$\r\"
!endmacro
!macro dirLeave dirName
pop $R0
SetOutPath $R0
!endmacro
then pass these to !insertfilemacro so instead of:
!define File "!insertmacro File"
...
${File} "subdir1\file1.ext
...
${File} "subdir1\subdir2\lotsOfFiles.txt"
...
one would use:
!insertfilemacro "subdir1" addFile dirEnter dirLeave
similar to 'File /R subdir1' except with logging or whatever
special activity you want done supported.
[I'm doing this from memory as I'm not at my computer at the
moment so the above example code may not be 100% correct,
but hopefully you get the gist. I should be home tommorrow
and can upload a complete sample.]
I am of course open to suggestions. I have seen in the
forums an external program that does similar, but it did not
come with source so not usable, and I would prefer not
adding extra program dependencies if possible.
----------------------------------------------------------------------
Comment By: Amir Szekely (kichik)
Date: 2004-11-26 19:24
Message:
Logged In: YES
user_id=584402
I have added an option to exclude files in the latest CVS
version. I have not used your code because I wanted to get
rid of some do_add_files clutter at the same time.
I still don't know about the macro thing... The solution
doesn't feel too natural. I'll to think about it some more.
BTW, I have manually updated the "nightly" snapshot on the
front page so you can skip the CVS lag.
----------------------------------------------------------------------
Comment By: Kenneth Davis (perditionc)
Date: 2004-10-21 07:35
Message:
Logged In: YES
user_id=164681
I forgot to mention, this was tested on Windows compiled
using VC6 and snapshot's project files. The Posix code
is completely untested, I'm not even sure if it will compile.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=373087&aid=1051250&group_id=22049
|