Kampfkarren / roblox-install

Get the install directory of Roblox in Rust
Mozilla Public License 2.0
7 stars 4 forks source link

`RobloxStudio::plugins_path` should respect (or at least document) the `Studio.PluginsDir` setting #33

Open kennethloeffler opened 1 year ago

kennethloeffler commented 1 year ago

It's possible for users of Roblox Studio to change the directory where Studio will look for local plugins using a setting called Studio.PluginsDir. With this in mind, the documentation for RobloxStudio::plugins_path leaves something to be desired: https://github.com/Kampfkarren/roblox-install/blob/80bd5d20dabbbc9e6c19b80cedc735279d57ad38/src/lib.rs#L234-L238

It doesn't quite return a path to the user's plugin directory - it returns hard coded paths instead: https://github.com/Kampfkarren/roblox-install/blob/80bd5d20dabbbc9e6c19b80cedc735279d57ad38/src/lib.rs#L168-L183 https://github.com/Kampfkarren/roblox-install/blob/80bd5d20dabbbc9e6c19b80cedc735279d57ad38/src/lib.rs#L97-L104

I think RobloxStudio::plugins_path should respect Studio.PluginsDir. Several dependents of roblox-install use RobloxStudio:plugins_path with the assumption that any model files placed there will be ran as plugins by Roblox Studio (off the top of my head, run-in-roblox, rbx-reflector, and now Rojo wants to at rojo-rbx/rojo#735). A user changing Studio.PluginsDir totally breaks that assumption.

From my point of view, it won't be that difficult to start respecting this setting. On Windows, Roblox Studio stores its settings in %LOCALAPPDATA%\Roblox\GlobalSettings_13.xml. On macOS, it's ~/Library/Roblox/GlobalSettings_13.xml. This file contains Roblox XML (it's really just an rbxmx) and may be parsed by rbx_xml. Because Studio.PluginsDir is of type QDir, there would have to be support added like in rojo-rbx/rbx-dom#182, but I think that's well within reach.

Then on initialization of RobloxStudio, roblox-install can do something like:

It would be awesome if RobloxStudio::plugins_pathactually did what it says, but I understand if it's too much complexity. I'd be fine with just mentioning Studio.PluginsDir in the documentation, being explicit about the fact that the returned path will not necessarily be where the current Roblox Studio install locates plugins.

Kampfkarren commented 1 year ago

I didn't know plugins directory was a thing, that is awesome