hikari.utility.os_tools
This file contains constants and functions containing operating system and path information / methods used in the package.
Functions
|
Return a string with absolute path to a specified file. Accepts zero or more |
Module Contents
- hikari.utility.os_tools.make_abspath(*path_elements)[source]
Return a string with absolute path to a specified file. Accepts zero or more strings, which are joined according to system-specific syntax. Relative paths are intepreted as having root at current working directory (cwd). Links and symbols such as ‘~’, ‘..’ or ‘/’ are expanded and interpreted. As such, function calls with no argument and ‘~’ as argument will yield string-paths to current working directory and home directory, respectively.
- Example:
>>> make_abspath() PosixPath('/home/username/hikari/hikari/utility') >>> make_abspath('~') PosixPath('/home/username') >>> make_abspath('~', 'cocoa/is', 'not/../hot.txt') PosixPath('/home/username/cocoa/is/hot.txt')
Running the script on Windows machine will yield an appropriate Windows Path. In particular, ‘cocoa/is’ will be intepreted as single directory.
- Parameters:
path_elements (str) – path element(s) to join and intepret, defaults to cwd.
- Returns:
string containing resolved absolute path to the specified location
- Return type:
str