|
|
#1 |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Callback function .onFileInstalled possible?
Hi,
before posting a feature request on sourceforge, I want to make sure if my idea could work. Would it be possible to have a callback function like .onFileInstalled that gets called for each file that was installed? The name of the last installed file could be in a global variable. This would make it possible to write a clean Log of the installed files even if File /r "filetree\*.*" was used. That log could be used for an uninstall routine which only deletes the files that were installed by the installer and were not changed afterwards. -Alessandro |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
That may be a good idea, but if it isn't going to be implemented, you could use the Dump log to file function which dumps the install details window text to a selected file.
There is also a More advanced dump log to file function which only logs files containing a selected string (this should help you) Good luck! -Stu |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Thanks,
I looked at the dump log functions, and they work well. It is a nice point to start. Since I would like to also have informations like file size, file date and maybe crc, I would have to parse the dump log and rewrite another log file. But that would be acceptable (for now). -Alessandro |
|
|
|
|
|
#4 | |
|
Debian user
(Forum King) Join Date: Jan 2003
Location: Arch land
Posts: 4,917
|
Quote:
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE. * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE. |
|
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Quote:
File /R "manyFiles\*.*" In don't know the files in "manyFiles\". -Alessandro |
|
|
|
|
|
|
#6 |
|
Debian user
(Forum King) Join Date: Jan 2003
Location: Arch land
Posts: 4,917
|
Display all files and directories?
code: * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE. * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE. |
|
|
|
|
|
#7 | |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Quote:
But If You just install a bunch of files into an existing file structure, I cannot track which files were installed by the installer. Well, I could use Your code before the installation and afterwards, and then look for the differences. But what, if someone else stored some files into that directory during the installation? -Alessandro |
|
|
|
|
|
|
#8 |
|
Debian user
(Forum King) Join Date: Jan 2003
Location: Arch land
Posts: 4,917
|
You can track the number of items, before and after the installation; then now you can compare
![]() code: /edit: Update coded
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE. * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE. |
|
|
|
|
|
#9 | |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Quote:
There are functions on the archive which recursively search directories for files. You could easily modify one of those functions and strip it down so that it simply creates a list of files in a directory and its sub-folders. Again though, this is all going to be done on run time, and it could take a while to generate a list depending on how many files were installed, how many sub-folders etc, so I think that the dump log is the best method currently. -Stu |
|
|
|
|
|
|
#10 | |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Quote:
Operations like file size reading or crc code generation on runtime are a bad idea if I do them all at once, for all the files. I guess the progressbar would stop for a long time, and the user would start the task manager in order to kill the installer. But with those callbacks I am dreaming of, these operations could be made for each file, after it was written. The installation would then also be slower but the extra calculation would be distributed over the whole time and the progressbar would still be alive. -Alessandro |
|
|
|
|
|
|
#11 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
NSIS has CRC implemented and checks whether or not the installer is corrupted on installer initialisation.
You used to be able to turn it on or off (in 1.9) but it's on as default now (I guess). The GetFileSize function in the Archive works by opening the file and reading it to get the file size. There are various other methods, like using the System plugin to call an API, but the Archive function would be the quickest method. The only thing that I can suggest, is that you write a program (in any language you prefer) which will make a list of the files which you want to put into your installer (by recursively reading each file name from the directory(s)), or you could do this manually. You could use a macro for each file like so: code: Then for inserting each of the files into the installer, use: code: With my NSIS Self-Extractor kit (http://nsis.sourceforge.net/archive/...&instances=0,8) I wrote a script generator consisting of DHTML (JavaScript + [X]HTML), and I used an ActiveX control for a recursive directory includer. With my Self-Extractor kit, each file could have an 'overwrite if file exists' prompt, therefore I used an !insertmacro (like above) for each file. The script generator read the directory and for each file, it outputted the !insertmacro code for me/whoever to use. I also once or twice used an NSIS installer itself to generate a list of files from about 10 directories and their subdirectories. If you use an NSIS script, you could also get the file sizes which could be then stored in your main installer for when you want to check for file differences. -Stu |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jul 2004
Posts: 6
|
Thanks, with all these tricks and solutions I cannot complain anymore .. for now
.And the NSIS Self-Extractor kit is very cool. The browser based script generator does a really nice job! Keep it on! - Alessandro |
|
|
|
|
|
#13 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Lol I just ran my script generator just now to create an installer for my HL map, and realised I left an alert in there that says "mo" (uploaded fixed product)
-Stu |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|