Skip to content

StoragePaths

Inherits: Service

Note

Its methods are not supported in web mode.

Methods

Methods#

get_application_cache_directory #

get_application_cache_directory() -> str

Returns the path to the application-specific cache directory.

If this directory does not exist, it is created automatically.

Returns:

  • str

    The path to a directory where the application may place cache files.

Raises:

get_application_documents_directory #

get_application_documents_directory() -> str

Returns the path to a directory for user-generated data.

This directory is intended for data that cannot be recreated by your application.

For non-user-generated data, consider using:

Raises:

Returns:

  • str

    The path to the application documents directory.

get_application_support_directory #

get_application_support_directory() -> str

Returns the path to a directory for application support files.

This directory is created automatically if it does not exist. Use this for files not exposed to the user. Do not use for user data files.

Raises:

Returns:

  • str

    The path to the application support directory.

get_console_log_filename #

get_console_log_filename() -> str

Returns the path to a console.log file for debugging.

This file is located in the application cache directory.

Raises:

Returns:

  • str

    The path to the console log file.

get_downloads_directory #

get_downloads_directory() -> str | None

Returns the path to the downloads directory.

The returned directory may not exist; clients should verify and create it if necessary.

Raises:

Returns:

  • str | None

    The path to the downloads directory, or None if unavailable.

get_external_cache_directories #

get_external_cache_directories() -> list[str] | None

Returns paths to external cache directories.

These directories are typically on external storage (e.g., SD cards). Multiple directories may be available on some devices.

Raises:

Returns:

  • list[str] | None

    A List of external cache directory paths, or None if unavailable.

get_external_storage_directories #

get_external_storage_directories() -> list[str] | None

Returns paths to external storage directories.

These directories are typically on external storage (e.g., SD cards). Multiple directories may be available on some devices.

Raises:

Returns:

  • list[str] | None

    A List of external storage directory paths, or None if unavailable.

get_external_storage_directory #

get_external_storage_directory() -> str | None

Returns the path to the top-level external storage directory.

Raises:

Returns:

  • str | None

    The path to the external storage directory, or None if unavailable.

get_library_directory #

get_library_directory() -> str

Returns the path to the library directory.

This directory is for persistent, backed-up files not visible to the user (e.g., sqlite.db).

Raises:

Returns:

  • str

    The path to the library directory.

get_temporary_directory #

get_temporary_directory() -> str

Returns the path to the temporary directory.

This directory is not backed up and is suitable for storing caches of downloaded files. Files may be cleared at any time. The caller is responsible for managing files within this directory.

Raises:

Returns:

  • str

    The path to the temporary directory.