get basename of the given path
- path <string>
- extname <string> | <number> provide 1 if you dont know the extension name
- @return basename <string>
Path_basename "~/path/to/foo.sh"
# output: foo.sh
Path_basename "~/path/to/foo.sh" ".sh"
# output: foo
# if you dont know the extension name, you can use the following
Path_basename "~/path/to/foo.sh" 1
# output: foo
get dirname of the given path
- path <string>
- @return dirname <string>
Path_dirname "~/path/to/foo.sh"
# output: ~/path/to
Path_dirname "../foo.sh"
# output: ..
get extension of the given path
- path <string>
- @return extension name <string>
Path_extname "~/path/to/foo.sh"
# output: .sh
check if the given path is absolute
- path <string>
Path_isAbs "/path/to/foo.sh"
# assert success
check if the given path is relative
- path <string>
Path_isRel "./path/to/foo.sh"
# assert success
join the given paths
- paths <string>
- @return joined path <string>
Path_join "/path/to/" "./foo.sh"
# output: /path/to/foo.sh
Path_join "path/to/" "../foo.sh"
# output: path/foo.sh
resolve the given paths into an absolute path
- paths <string>
- @return an absolute path <string>
Path_resolve "path/to" "../foo.sh"
# output: $PWD/path/foo.sh