Module with basic filesystem objects.
This module must be used by all other zim modules for filesystem interaction. It takes care of proper encoding file paths (system dependent) and file contents (UTF-8) and implements a number of sanity checks.
The main classes are File
and Dir
which implement file and folder objects. There is also a singleton object to represent the whole filesystem, whichprovides signals when a file or folder is created, moved or deleted. This is stored in zim.fs.FS
.
Class | Dir |
Class representing a single file system folder |
Class | File |
Class representing a single file. |
Class | FileUnicodeError |
Error raised when there is an issue decoding the file contents. Typically due to different encoding where UTF-8 is expected. |
Class | FileWriteError |
Error raised when we can not write a file. Either due to file permissions or e.g. because it is detected the file changed on disk. |
Class | FilteredDir |
Class implementing a folder with a filtered listing. Can be used to e.g. filter all objects that are also ignored by version control. |
Class | FSObjectMonitor |
Undocumented |
Class | FSSingletonClass |
Class used for the singleton 'zim.fs.FS' instance |
Class | PathLookupError |
Error raised when there is an error finding the specified path |
Class | TmpFile |
Class for temporary files. These are stored in the temp directory and by default they are deleted again when the object is destructed. |
Class | UnixPath |
Base class for Dir and File objects, represents a file path |
Class | WindowsPath |
Base class for Dir and File objects, represents a file path on windows. |
Function | adapt_from_newfs |
Undocumented |
Function | adapt_from_oldfs |
Undocumented |
Function | cleanup_filename |
No summary |
Function | format_file_size |
No summary |
Function | get_tmpdir |
No summary |
Function | is_hidden_file |
Undocumented |
Function | isabs |
Wrapper for os.path.isabs. @param path: a file system path as string @returns: True when the path is absolute instead of a relative path |
Function | lrmdir |
Wrapper for os.rmdir that also knows how to unlink symlinks. Fails when the folder is not a link and is not empty. @param path: a file system path as string |
Function | normalize_file_uris |
No summary |
Function | normalize_win32_share |
No summary |
Constant | FS |
Undocumented |
Constant | IMAGE_EXTENSIONS |
Undocumented |
Variable | Gio |
Undocumented |
Variable | logger |
Undocumented |
Variable | mimetypes |
Undocumented |
Variable | xdgmime |
Undocumented |
Function | _glob_to_regex |
Undocumented |
Function | _md5 |
Undocumented |
Function | _replace_file |
Undocumented |
Variable | _tmpdir |
Undocumented |
Parameters | |
name | the filename as string |
Returns | |
the name with invalid characters removed |
Parameters | |
bytes | file size in bytes as integer |
Returns | |
size as string |
Parameters | |
path | a file system path as string |
Returns | |
True when the path is absolute instead of a relative path |
Parameters | |
path | a file system path as string |
Parameters | |
path | a filesystem path or URL |
Returns | |
the proper URI or the original input path |
Parameters | |
path | a filesystem path or URL |
Returns | |
the platform specific path or the original input path |