Is it possible to uninstall previous version of a custom toolbox as part of toolbox installation?

3 次查看(过去 30 天)
I have created a custom MATLAB toolbox. As part of the installation process, is it possible to uninstall the previous version (if installed)? I was looking for a seamless installation so that users don't have to explicitly remember to uninstall the previous version.

回答(1 个)

Jan
Jan 2017-8-3
It depends. If the toolbox is stored in a specific folder, you can delete this folder. But perhaps the users modify the M-files and deleting the folder might not be wanted.
A strategy would be to store the folder location in Matlab's preferences (see setpref). Include a checksum in each file. When a new version is installed, use getpref to obtain the former folder, check if any file was modified and if not ask the user if the former version should be deleted.
I keep older versions of toolboxes for a comparison of the results. This is useful to control, if the new version has bugs or changed output.
  2 个评论
Sunny Talekar
Sunny Talekar 2017-8-3
Hi Jan, Your answer conceptually sounds good. I'm afraid I don't quite understand how to implement it - as in at what point should I be manipulating the preferences.
The toolbox gets installed in the toolboxes directory under 'userpath'. Ideally, I'd like to make the process transparent to the end user - uninstall the previous one every time you install the new one. The only way I could think of is installing using m-script (instead of .mltbx) which checks for previously installed versions, removes it and then installs the new one. Doesn't sound elegant though.
Jan
Jan 2017-8-3
uninstall the previous one every time you install the new one
I would hate this as a customer.
I assume the uninstallation can be solved in many ways transparently. Simply start to implement it and solve the problems step by step. It is hard to suggest an exact way without providing the full program.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by