Disk Util¶
This modules handles disk operations. Namely combining paths, checking them and creating folders..
-
git_sh_sync.util.disk.joined(*locs)¶ Joins paths together.
Parameters: locs – Single path elements to jointogether.Returns: A full path combined by the following rules: - Leading
slashesare stripped from all but the first element Expanduseris applied (~)Expandvarsis applied (e.g.$HOMEis then the same as~)- Finally
realpathis applied to resolve symlinks and return a full path
- Leading
-
git_sh_sync.util.disk.spare(*locs, folder=False)¶ Checks if a path is not already occupied
Parameters: - locs – Input Parameter for
joined() - folder – Flag to signal if to check for a file or folder
Returns: True,FalseorNoneby the following rules:- If a folder is present and folder =
True:False - If a folder is present and folder =
False:None - If a file is present and folder =
False:False - If a file is present and folder =
True:None - If nothing is present:
True
- locs – Input Parameter for