Answer the question
In order to leave comments, you need to log in
How can a program delete itself?
Good afternoon!
I want to write a program, but so far there is one problem - how can the program delete itself?
The application is cross-platform, it needs support for Linux, OS X and Linux.
The first thing that came to my mind was to use local shells (bash for Linux, cmd for Windows, Terminal for OS X), but I don’t really want to get involved with platform-specific tools.
Are there any other ways that are more versatile? Framework used - Qt
Answer the question
In order to leave comments, you need to log in
You can use the Qt Installer Framework 1.5.0 cross-platform installer to distribute your utility under various operating systems . If my memory serves me, the possibility of deleting the program is present there. In general, it's best to do this:
For Windows - an installer that creates a shortcut to "unist.exe" in the "Start" menu, which removes the program.
For Linux - deb-package/tar.gz-package. Linuxoids do not need the removal function, this task will be solved by the package manager, against which it is not recommended to install software.
I don’t know about Mac OS / OS X, but I think there is an option to remove an installed application from the installed programs directory.
To make the function of removing this program inside the program is a very bad form.
create a program "uninstaller" that removes the program, and then creates a one-time cron task to remove the "uninstaller"
Write the program as f*cking as possible - the user will delete it himself.
for OS X it is not necessary, because the program is simply copied there and removed by simply deleting files.
for Linux, the same thing or the package manager will do everything, for Windows, as you have already been told, an uninstaller is written that removes your program keys from the registry + removes shortcuts and program files - nothing complicated.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question