Function in stdx_filesystem.h

x_fs_path_common_prefix

Compute the common prefix of two paths.

X_FILESYSTEM_API bool x_fs_path_common_prefix(
 const char *from_path,
 const char *to_path,
 XFSPath *out_path
);

Parameters

const char *from_path
First path.
const char *to_path
Second path.
XFSPath *out_path
Output path receiving the common prefix.

Returns

True if a common prefix was written (may be empty depending on implementation), false on failure.

Function in stdx_filesystem.h

x_fs_path_relative_to

Compute a relative path from one path to another.

X_FILESYSTEM_API size_t x_fs_path_relative_to(
 const XFSPath *from_path,
 const XFSPath *to_path,
 XFSPath *out_path
);

Parameters

const XFSPath *from_path
Base path to compute the relative path from.
const XFSPath *to_path
Target path to compute the relative path to.
XFSPath *out_path
Output path receiving the relative result.

Returns

Length of the resulting path on success, 0 on failure.

Function in stdx_filesystem.h

x_fs_path_relative_to_cstr

Compute a relative path from one C-string path to another.

X_FILESYSTEM_API size_t x_fs_path_relative_to_cstr(
 const char *from_path,
 const char *to_path,
 XFSPath *out_path
);

Parameters

const char *from_path
Base path.
const char *to_path
Target path.
XFSPath *out_path
Output path receiving the relative path.

Returns

Length of the written relative path, or 0 on failure.