This simple function will return the path part of the given file or folder specification. That is the part upto and inclusive the rightmost backslash, but without the final name component, which is usually the actual file or folder name. To get that file or folder name, you would use the function FilePart$() instead.
SYNTAX:
path$ = PathPart$ (fileSpec$)
INPUTS:
fileSpec$ (STRING)
- The file or folder specification to get the path part from. Empty input is allowed here and will result into an empty path, which usually denotes the current working directory.
RESULT:
path$ (STRING)
- Depending on the given file or folder specification:
- The path part inclusive the trailing backslash (regular operation).
- May be identical to fileSpec$, if it was a path only (trailing backslash found).
- Empty, if input was empty or a single name component only, which usually denotes a file or folder name without an explicit path (no backslash found).
- Both of it implies the current working directory as path.
In either case the result is a valid path eg. for CHDIR or to append new names to, if you wanna create new files (OPEN) or folders (MKDIR) in the same location as the given source object.