libdesktop.directories

A module for interacting with system and user directories.

libdesktop.directories.get_config_dir(program='', system_wide=False)[source]

Get the configuration directory.

Get the configuration directories, optionally for a specific program.

Parameters:
  • program (str) – The name of the program whose configuration directories have to be found.
  • system_wide (bool) – Gets the system-wide configuration directories.
Returns:

A list of all matching configuration directories found.

Return type:

list

libdesktop.directories.get_config_file(program, system_wide=False)[source]

Get the configuration file for a program.

Gets the configuration file for a given program, assuming it stores it in a standard location. See also get_config_dir().

Parameters:
  • program (str) – The program for which to get the configuration file.
  • system_wide (bool) – Whether to get the system-wide file for the program.
Returns:

A list of all matching configuration files found.

Return type:

list

libdesktop.directories.get_desktop_dir()[source]

Get the user desktop directory.

Get the user directory for storing files on the Desktop.

Returns:The path to the user Desktop directory.
Return type:str
libdesktop.directories.get_documents_dir()[source]

Get the user directory for documents.

Get the user directory for storing documents.

Returns:The path to the user Documents directory.
Return type:str
libdesktop.directories.get_downloads_dir()[source]

Get the user directory for downloads.

Get the user directory for storing downloaded files.

Returns:The path to the user Downloads directory.
Return type:str
libdesktop.directories.get_music_dir()[source]

Get the user directory for music.

Get the user directory for storing music.

Returns:The path to the user Music directory.
Return type:str
libdesktop.directories.get_pictures_dir()[source]

Get the user directory for pictures.

Get the user directory for storing pictures.

Returns:The path to the user Pictures directory.
Return type:str
libdesktop.directories.get_videos_dir()[source]

Get the user directory for videos.

Get the user directory for storing videos.

Returns:The path to the user Videos directory.
Return type:str
libdesktop.directories.windows_get_program_files_dir()[source]

Get the Windows system Program Files directory.

Get the Windows system Program Files directory.

Returns:The path to the Windows system Program Files directory.
Return type:str
libdesktop.directories.windows_get_program_files_x64_dir()[source]

Get the Windows system Program Files (x64) directory.

Get the Windows system directory for storing 64-bit programs, that is, Program Files (x64).

Note

This will fail (possibly with an interpreter crash) on 32-bit systems, or a 32-bit Python.

Returns:The path to the Windows system Program Files (x64) directory.
Return type:str
libdesktop.directories.windows_get_program_files_x86_dir()[source]

Get the Windows system Program Files (x86) directory.

Get the Windows system directory for storing 32-bit programs on a 64-bit system, that is, Program Files (x86).

Note

This will return the normal Program Files directory (as given in windows_get_program_files_dir()) on a 32-bit system, or a 32-bit Python.

Returns:The path to the Windows system Program Files (x86) directory.
Return type:str
libdesktop.directories.windows_get_public_dir()[source]

Get the Windows system Public directory.

Get the Windows system Public directory.

Returns:The path to the system Public directory.
Return type:str
libdesktop.directories.windows_get_system32_dir()[source]

Get the Windows system System32 directory.

Get the Windows system System32 directory (example: C:/Windows/System32/)

Returns:The path to the Windows system System32 directory.
Return type:str
libdesktop.directories.windows_get_windows_dir()[source]

Get the Windows system directory.

Get the Windows system Windows directory (example: C:/Windows/)

Returns:The path to the Windows system Windows directory.
Return type:str