You are here

Delete a file with the launcher

4 posts / 0 new
Last post
LucyFan
Offline
Last seen: 5 years 1 month ago
Joined: 2007-03-13 15:24
Delete a file with the launcher

Hi

I know you can move files, and remove directories but is it possible to delete a file.

I have a piece of freeware that appears to be no longer supported and am making a launcher for my own personal use. The program list items as a directory tree and remembers it's state by the use of an xml file in it's root directory. I would like to delete this file so the directory tree is always closed (first use) I can do it manually without any adverse affects on the software and wondered if a launcher could delete the file either before or after launching the program?

Thanks

John T. Haller
John T. Haller's picture
Online
Last seen: 1 min 55 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Custom Code

You'll need to do it via custom code. So, in the App\AppInfo\Launcher directory, create a file called custom.nsh and place this inside it:

${SegmentFile}

${SegmentPrePrimary}
    Delete "$EXEDIR\NameOf.File"
!macroend

Replace the name of your file, of course. Then recompile your launcher. That will delete that file on each run of the main instance of the app (if you have it set for multiple instances).

Sometimes, the impossible can become possible, if you're awesome!

LucyFan
Offline
Last seen: 5 years 1 month ago
Joined: 2007-03-13 15:24
Great Thanks

Thanks very much exactly what I was after.

Minor point, there is a bug in the documentation that has the placement of the custom.nsh in the Other\Source folder, is there somewhere I can log things like this or maybe create an updated html page for you and upload it?

John T. Haller
John T. Haller's picture
Online
Last seen: 1 min 55 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Moved

It moved some time ago. The launcher should automatically move it from Other\Source to App\AppInfo\Launcher as you compile it.

The manual has a few discrepancies that need addressing.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments