univrsal / input-overlay

Show keyboard, gamepad and mouse input on stream
GNU General Public License v2.0
2.62k stars 235 forks source link

Hard coded path to ~/.config. #391

Closed Samueru-sama closed 3 months ago

Samueru-sama commented 3 months ago

Describe the bug I have $XDG_CONFIG_HOME defined as $HOME/.local/config instead of the default location of $HOME/.config.

This plugin is creating an empty $HOME/.config directory every time OBS is started.

After quickly reading the source code, the issue is likely on lines 60 to 62 of the config.cpp file:

    /* Assure that ~/.config folder exists */
    if (!QDir::home().exists(".config") && !QDir::home().mkdir(".config"))
        berr("Couldn't create ~/.config, configuration files won't be saved");

The plugin needs to check for XDG_CONFIG_HOME first and if it defined use that instead, if it isn't defined then it falls back to $HOME/.config there are libraries like Glib that do this function as well.

To Reproduce

Expected behavior The empty directory should not be created and it should use the location defined by the XDG Variable.

univrsal commented 3 months ago

This behavior is wrong anyways. OBS has a separate folder for plugin configurations in ~/.config/obs-studio/plugin_config/<plugin_name>. I assume that adheres to XDG_CONFIG_HOME. You can try the latest build to test it: https://github.com/univrsal/input-overlay/actions/runs/8498752259

It should try to load filters that are saved in the old location but will only save them to the new path and won't create any other config folder anymore.

Samueru-sama commented 3 months ago

This behavior is wrong anyways. OBS has a separate folder for plugin configurations in ~/.config/obs-studio/plugin_config/<plugin_name>. I assume that adheres to XDG_CONFIG_HOME. You can try the latest build to test it: https://github.com/univrsal/input-overlay/actions/runs/8498752259

It should try to load filters that are saved in the old location but will only save them to the new path and won't create any other config folder anymore.

It works! thanks for fixing it.