normalizes the user defined paths a bit better to avoid inconsistent
results with os.path.basename(), os.path.join(), etc.
For example:
$ cephadm shell --mount ~/
Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit
669840abc037fc8c49255a68bebae9a8279eac86)
def pathify(p):
# type: (str) -> str
- if not p.startswith('/'):
- return os.path.join(os.getcwd(), p)
- return p
+ p = os.path.expanduser(p)
+ return os.path.abspath(p)
def get_file_timestamp(fn):
try: