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

Handling of .plugged directories in unexpected locations #39

Open
Tattomoosa opened this issue Sep 11, 2024 · 0 comments
Open

Handling of .plugged directories in unexpected locations #39

Tattomoosa opened this issue Sep 11, 2024 · 0 comments

Comments

@Tattomoosa
Copy link

Tattomoosa commented Sep 11, 2024

Referencing #33 (comment) where it's mentioned a proposal to move the default plugin directory causes bad behavior for the end user. I am in support of changing the default directory but I think the fix migration-wise is not any sort of automated migration but instead handling the general case of finding .plugged outside of where gd-plug thinks it should be.

There are a couple steps for this.

1. Move directory configuration into res://plug.gd, only falling back to default directory

eg

func _config():
  plugged_dir = "addons/"

This ensures that the .plugged directory won't change for a user when updating via upgrade, it feels like something that should be user configurable. Thinking this should not be added with the default path when creating res://plug.gd, but should be added to documentation

2. Search for other .plugged directories if .plugged isn't found at plugged_dir path

If .plugged isn't where it's expected to be in _plug_start(), scan the project for .plugged directories.
If no .plugged directory is found elsewhere, create it.

If another .plugged directory is found:

  1. If ENV_FORCE is set, delete it
  2. Otherwise, warn the user and quit with an error message, something like
.plugged directory found at unexpected location

.plugged directory location: "res://wherever/.plugged"
expected location: "res://.plugged"

If this is unintentional, run command again with force
If this is an intended overridden .plugged folder path, add configuration to plug.gd:

func _config():
  plugged_dir = "res://wherever/.plugged"

Handling the case of changing the default .plugged directory?

With these changes so far, I believe changing the default location of the .plugged folder requires only one forced upgrade by the end user and no manual file manipulation. I think this is probably ok and maybe even preferred since users may have to update their .gitignore or other files and should be aware of the change

Maybe add a more specific warning if the .plugged location is changing from res://.plugged to res://addons/gd-plug/.plugged.

gd-plug x.x.x has changed the default directory where it keeps plugin repos from "res://.plugged" to "res://addons/gd-plug/.plugged", you will have to force install once or remove the existing .plugged directory manually

Alternatively, more seamless for a casual user, would be that since upgrade uses force mode anyway, upgrade could just set force before _plug_start and then its handled automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant