enebo / Purugin

Ruby Minecraft Plugin support on top of bukkit
237 stars 32 forks source link

purogo directory as an absolute path prevent moving the server directory #32

Closed eregon closed 9 years ago

eregon commented 12 years ago

Hello,

The purogo plugin saves its directory via Purugin::Config as an absolute path. If the server directory is moved, purogo won't find the shape files anymore.

One solution would be to save the path as relative to cwd or some element of the server hierarchy (the plugins/ dir, purugin.jar, the server directory), if within that directory. Another would be to accept multiple paths, and always consider the File.join(File.dirname(__FILE__), "purogo") one. And a last one which would only temporally solves it is to not persist default values. But I guess it's intended as it's more practical to customize if the default config is already there.

What do you think?

enebo commented 12 years ago

I guess it could always write relative CWD and if you wanted a totally different location you could write it as an absolute path. The fact that the default saves as absolute is probably the main issue. Changing it to write a relative path would be a welcome PR. It also means a little more logic when reading the value to File.absolute?(value) [or something similar].

As for persisting defaults, that is something which could also be changed. I guess my '!' methods encourage persisting defaults. Leaving off the '!' on set would make it not save it by default. I am unsure what idiom should be encouraged?

eregon commented 12 years ago

PR done as #33. As for get!, I really don't know which is better.

enebo commented 9 years ago

Purugin will be rewritten against a different mod. Closing issues and PRs since they will likely not apply