Opened 7 years ago

Closed 6 years ago

#4854 closed enhancement (fixed)

Feature request: delete folder related with package deletion

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Adeel Asghar
Priority: high Milestone: 1.14.0
Component: OMEdit Version:
Keywords: Cc:

Description

If a package is deleted in OpenModelica, the underlying package.mo is renamed to package.bak-mo. This is certainly in line with the Modelica specification, since reloading a library then omits re-loading the previously deleted package.

When working with Git or Subversion, a deleted package may result in some leftover files with the extensions mo and order. When committing a library from which a package was deleted, the leftover files are not automatically excluded from the commit. If the leftover files oder the affected directory are not manually deleted, there may appear unmaintained code in the repository.

It were helpful to provide the following feature in OpenModelica, when a library is stored as folders and files: When deleting a package from a library (right click, select "Delete") then following dialog appears (in the current version of OpenModelica):

Are you sure you want to delete PACKAGENAME? 
Everything contained inside this class will also be deleted.

The button options are then No and Yes. It were good to have the additional option Yes, delete dirctory, to autoamtically delete the underlying directory. This would definitely simplify the maintenance of Modelica code in Git and Subversion repositories.

Change History (7)

comment:1 by Christian Kral <dr.christian.kral@…>, 7 years ago

One could even consider to provide a similar feature to other Modelica classes, using the option Yes, delete file. This would then delete the affected file instead of renaming it to bak-mo.

comment:2 by anonymous, 7 years ago

I believe this could also be solved by using a proper .gitignore file!?

comment:3 by Christian Kral <dr.christian.kral@…>, 7 years ago

On my opinion, it makes sense to remove leftover files from time to time anyways. So I were glad if OMEdit would support the removing of unused and unmaintained files.

comment:4 by anonymous, 7 years ago

I had to read your SO question to understand what is really happening:
https://stackoverflow.com/questions/49717051/exclude-directories-in-gitignore-which-contain-a-particular-file
And yes, when using git or subversion, nobody wants to keep those backup files on the disk (or worse, in the remote repository), because you already have a backup in the git history and you can always go back.

comment:5 by dr.christian.kral@…, 7 years ago

comment:6 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:7 by Adeel Asghar, 6 years ago

Resolution: fixed
Status: newclosed

I have added a new setting Create a model.bak-mo backup file when deleting a model. in Tools->Options->General. This is set to true by default. Uncheck it if you don't want the backup files.

Done in 0d01932/OpenModelica.

Note: See TracTickets for help on using tickets.