gui.settings.settings_path

gui.settings.settings_path(env=None, platform=None, home=None)

The settings file of the current user.

The directory is ~/Library/Application Support/spotregen on macOS, %APPDATA%\spotregen on Windows and $XDG_CONFIG_HOME/spotregen (default ~/.config/spotregen) elsewhere.

Parameters

Name Type Description Default
env Mapping[str, str] | None The environment. Defaults to os.environ. None
platform str | None The platform name. Defaults to sys.platform. None
home Path | None The home directory. Defaults to the user’s. None

Returns

Name Type Description
Path Path The path of settings.json; neither the file nor its directory has to exist.

Examples

from pathlib import Path

from spotregen.gui.settings import settings_path

print(settings_path({}, "darwin", Path("/Users/me")))
print(settings_path({"XDG_CONFIG_HOME": "/cfg"}, "linux", Path("/home/me")))
/Users/me/Library/Application Support/spotregen/settings.json
/cfg/spotregen/settings.json