Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstalling (or updating) an extensions that has subdirectories results in an error #3385

Closed
thkwznk opened this issue Jun 21, 2022 · 9 comments
Assignees
Labels
Milestone

Comments

@thkwznk
Copy link
Contributor

thkwznk commented Jun 21, 2022

Uninstalling (or updating, I'm guessing it's an uninstall+install combo action) an extension that has subdirectories in its directory results in an error shown below.

image

It leaves the extension directory with empty subdirectories, there are zero files left.

Aseprite and System version

  • Aseprite version: 1.2.35-x64
  • System: Windows 11
@Gasparoken
Copy link
Member

Gasparoken commented Jun 22, 2022

Thanks for this report @thkwznk. The closest attempt to reproduce this bug was when I added an additional folder inside an already installed extension folder, and then I tried to uninstall it.
As the new folder do not belongs to the extension file systm reported in "__info.json", Aseprite cannot remove it.

This makes me think that if an extension is capable of saving files inside the folder of the same extension, at the moment of uninstalling it -if it is not informed in "__info.json"- Aseprite will not be able to remove it.

Question: Does this happen with many extensions or just one in particular? Which?
EDIT: I was able to reproduce it a couple of times as you described (adding extra subdirectory inside of the extension folder). But other attempts, the directories are removed successfully (even with the extra subdirectory added). Anyway, if "__info.json" matches the subdirectory structure of the extension, all is well.

@dacap dacap added the bug label Jun 23, 2022
@dacap dacap added this to the v1.2.36 milestone Jun 23, 2022
@dacap
Copy link
Member

dacap commented Jun 23, 2022

If I remember correctly the uninstalling logic of extension will try to delete all files from the __info.json file, but in that file directories are not listed, so yes, if there is a subdirectory in the extension, the files will be deleted but then the subdir will not. So I think there is a bug there 👍

@Gasparoken
Copy link
Member

To stay on the same page: I guess the correct behavior is:

  • Delete the original content of the extension
  • Do not delete the files inside custom folders
  • Unstalling will be successful, even with custom folders.
  • Perhaps add an Alert "Warning: Custom folders were found which were not deleted."

@dacap correct me or add a comment if I'm wrong.

@dacap
Copy link
Member

dacap commented Jul 14, 2022

There shouldn't be any new alert. It's only a thing of deleting subdirectories after deleting all files listed in __info.json (when the files are being deleted, we can create a list of subdirectories, and then delete them).

Gasparoken added a commit to aseprite/laf that referenced this issue Jul 15, 2022
Gasparoken added a commit to aseprite/laf that referenced this issue Jul 15, 2022
Gasparoken added a commit that referenced this issue Jul 15, 2022
…results in an error (fix #3385)

Prior to this fix, any additional external files or directories within the Extension's directory tree, break the subdirectory removal iteration, resulting in empty subdirectories and a console error.
Gasparoken added a commit that referenced this issue Jul 15, 2022
…results in an error (fix #3385)

Prior to this fix, any additional external files or directories within the Extension's directory tree, break the subdirectory removal iteration, resulting in empty subdirectories and a console error.
@Gasparoken Gasparoken removed the wip label Jul 15, 2022
@dacap dacap modified the milestones: v1.2.36, v1.2.38 Jul 19, 2022
@dacap dacap modified the milestones: v1.2.39, v1.2.40 Aug 3, 2022
@dacap
Copy link
Member

dacap commented Aug 4, 2022

I was able to reproduce it a couple of times as you described (adding extra subdirectory inside of the extension folder). But other attempts, the directories are removed successfully (even with the extra subdirectory added). Anyway, if "__info.json" matches the subdirectory structure of the extension, all is well.

In the past I think I was able to reproduce the problem without adding new files/subdirs manually after the installation. Now it looks like I cannot reproduce it, the only way to reproduce it is just adding new files/subdirs manually. In case someone has a test package to reproduce this with Install/Update without touching the installed folder manually, it would be great to attach it to a post here.

@thkwznk
Copy link
Contributor Author

thkwznk commented Aug 4, 2022

I just tried with extensions that produced this issue for me but all of them work correctly now in v1.2.39 and v1.3-beta20.

@Gasparoken
Copy link
Member

I share the link to download the extension that I was testing to reproduce this error: https://community.aseprite.org/t/extension-animation-suite/13322 (nice extension @thkwznk 😄).
I was able to reproduce it by adding a new external folder within the extension's directory structure.

@Gasparoken
Copy link
Member

Gasparoken commented Sep 21, 2022

@dacap something is to be fixed here?

As I said in the first reply:

Anyway, if "__info.json" matches the subdirectory structure of the extension, all is well.

But I found that if there is a new external folder present, the deletion of the directories will not complete (leaving empty folders as I said here). I think this PR solve this case as much as possible (leaving only the external folders intact).

@dacap
Copy link
Member

dacap commented Sep 21, 2022

I was able to reproduce it creating new empty dirs. And the PR fixes the error message, I think that is enough.

Gasparoken added a commit that referenced this issue Sep 21, 2022
…results in an error (fix #3385)

Prior to this fix, any additional external files or directories within the Extension's directory tree, break the subdirectory removal iteration, resulting in empty subdirectories and a console error.
Gasparoken added a commit that referenced this issue Sep 22, 2022
…results in an error (fix #3385)

Prior to this fix, any additional external files or directories within the Extension's directory tree, break the subdirectory removal iteration, resulting in empty subdirectories and a console error.
@dacap dacap closed this as completed in 877ae9e Sep 22, 2022
@dacap dacap modified the milestones: v1.2.41, v1.3.0 Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants