maestral.config.base

This module contains helper functions for config management. Paths for config files are defined here instead of the utils.appdirs module to avoid imports from outside the config module.

Module Contents

Functions

to_full_path(path: str, subfolder: Optional[str], filename: Optional[str], create: bool) → str

get_home_dir() → str

Returns user home directory. This will be determined from the first

get_conf_path(subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True) → str

Returns the default config path for the platform. This will be:

get_data_path(subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True) → str

Returns the default path to save application data for the platform. This will be:

maestral.config.base.to_full_path(path: str, subfolder: Optional[str], filename: Optional[str], create: bool)str[source]
maestral.config.base.get_home_dir()str[source]

Returns user home directory. This will be determined from the first valid result out of (osp.expanduser(“~”), $HOME, $USERPROFILE, $TMP).

maestral.config.base.get_conf_path(subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True)str[source]

Returns the default config path for the platform. This will be:

  • macOS: “~/Library/Application Support/<subfolder>/<filename>.”

  • Linux: ``XDG_CONFIG_HOME/<subfolder>/<filename>”

  • other: “~/.config/<subfolder>/<filename>”

Parameters
  • subfolder – The subfolder for the app.

  • filename – The filename to append for the app.

  • create – If True, the folder subfolder will be created on-demand.

maestral.config.base.get_data_path(subfolder: Optional[str] = None, filename: Optional[str] = None, create: bool = True)str[source]

Returns the default path to save application data for the platform. This will be:

  • macOS: “~/Library/Application Support/SUBFOLDER/FILENAME”

  • Linux: “$XDG_DATA_DIR/SUBFOLDER/FILENAME”

  • fallback: “$HOME/.local/share/SUBFOLDER/FILENAME”

Note: We do not use “~/Library/Saved Application State” on macOS since this folder is reserved for user interface state and can be cleared by the user / system.

Parameters
  • subfolder – The subfolder for the app.

  • filename – The filename to append for the app.

  • create – If True, the folder subfolder will be created on-demand.