Aller au contenu

Filepath Op

Ce contenu n’est pas encore disponible dans votre langue.

Perform operations on filepaths.

PortDescription
Path
Set of operations. Look at the addendum below for more information.
PortDescription

Returns the last element of the path. If the path is empty, Base returns ..

Path StyleInput PathOutput
POSIX-style/home/user/file.txtfile.txt
POSIX-style/home/user/user
POSIX-style(empty).
Windows-styleC:\Users\user\file.txtfile.txt
Windows-styleC:\Users\user\user
Windows-style(empty).

Returns the shortest path name equivalent to path by purely lexical processing.

Path StyleInput PathOutput
POSIX-style/home/user/../user/file.txt/home/user/file.txt
POSIX-style/home/user/./file.txt/home/user/file.txt
POSIX-style(empty).
Windows-styleC:\Users\user\..\user\file.txtC:\Users\user\file.txt
Windows-styleC:\Users\user\.\file.txtC:\Users\user\file.txt
Windows-style(empty).

Returns all but the last element of the path, typically the directory. If the path is empty, Dir returns ..

Path StyleInput PathOutput
POSIX-style/home/user/file.txt/home/user
POSIX-style/home/user//home
POSIX-stylefile.txt.
POSIX-style(empty).
Windows-styleC:\Users\user\file.txtC:\Users\user
Windows-styleC:\Users\user\C:\Users
Windows-stylefile.txt.
Windows-style(empty).

Returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final slash-separated element of path; it is empty if there is no dot.

Path StyleInput PathOutput
POSIX-style/home/user/file.txt.txt
POSIX-style/home/user/file
POSIX-style(empty)
Windows-styleC:\Users\user\file.txt.txt
Windows-styleC:\Users\user\file
Windows-style(empty)

Converts slashes in paths to the native format.

Path StyleInput PathOutput
POSIX-style/home/user/file.txt/home/user/file.txt (No change)
POSIX-style(empty)(empty)
Windows-styleC:/Users/user/file.txtC:\Users\user\file.txt
Windows-style(empty)(empty)

Converts the native format to slashes.

Path StyleInput PathOutput
POSIX-style/home/user/file.txt/home/user/file.txt (No change)
POSIX-style(empty)(empty)
Windows-styleC:\Users\user\file.txtC:/Users/user/file.txt
Windows-style(empty)(empty)

Returns the leading volume name, which is the drive letter followed by a colon for Windows-style paths. For POSIX-style paths, it returns an empty string.

Path StyleInput PathOutput
POSIX-style/home/user/file.txt""
POSIX-style(empty)""
Windows-styleC:\Users\user\file.txtC:
Windows-style(empty)

ID: core/filepath-op@v1