feature: remove path manipulation functions from fs.h

This commit is contained in:
MechSlayer 2025-09-09 19:51:52 +02:00
parent 2194e4c805
commit d56466526b

View file

@ -523,139 +523,4 @@ DRANG_PLATFORM_API int drang_fs_get_cwd(char *buffer, size_t size, size_t *out_s
*/
DRANG_PLATFORM_API int drang_fs_set_cwd(const char *path);
/**
* @brief Joins two path components.
*
* Combines two path components into a single path using the appropriate
* platform-specific path separator.
*
* @param[out] result Buffer to store the joined path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path1 First path component.
* @param[in] path2 Second path component.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - paths joined successfully.
* @retval DRANG_EINVAL Invalid parameter (result, path1, or path2 is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @remarks Uses platform-appropriate path separators. If out_size is provided,
* it contains the required buffer size on DRANG_ENOMEM.
* The result is always null-terminated.
*/
DRANG_PLATFORM_API int drang_fs_path_join(
char *result, size_t result_size, const char *path1, const char *path2, size_t *out_size);
/**
* @brief Joins two path components with explicit lengths.
*
* Combines two path components into a single path using the appropriate
* platform-specific path separator. Path components are specified with
* explicit lengths rather than being null-terminated.
*
* @param[out] result Buffer to store the joined path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path1 First path component.
* @param[in] path1_length Length of the first path component.
* @param[in] path2 Second path component.
* @param[in] path2_length Length of the second path component.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - paths joined successfully.
* @retval DRANG_EINVAL Invalid parameter (result, path1, or path2 is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @remarks Useful when working with non-null-terminated path strings.
* The result is always null-terminated.
*/
DRANG_PLATFORM_API int drang_fs_path_join_length(char *result,
size_t result_size,
const char *path1,
size_t path1_length,
const char *path2,
size_t path2_length,
size_t *out_size);
/**
* @brief Normalizes a file path.
*
* Resolves relative path components (. and ..) and removes redundant
* separators to produce a canonical path representation.
*
* @param[out] result Buffer to store the normalized path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path Path to normalize.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - path normalized successfully.
* @retval DRANG_EINVAL Invalid parameter (result or path is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @remarks Resolves . and .. components and removes duplicate separators.
* Does not resolve symbolic links. The result is always null-terminated.
*/
DRANG_PLATFORM_API int drang_fs_path_normalize(char *result, size_t result_size, const char *path, size_t *out_size);
/**
* @brief Normalizes a file path with explicit length.
*
* Resolves relative path components (. and ..) and removes redundant
* separators to produce a canonical path representation. The input path
* is specified with an explicit length rather than being null-terminated.
*
* @param[out] result Buffer to store the normalized path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path Path to normalize.
* @param[in] path_length Length of the input path.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - path normalized successfully.
* @retval DRANG_EINVAL Invalid parameter (result or path is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @remarks Useful when working with non-null-terminated path strings.
* The result is always null-terminated.
*/
DRANG_PLATFORM_API int drang_fs_path_normalize_length(
char *result, size_t result_size, const char *path, size_t path_length, size_t *out_size);
/**
* @brief Converts a path to absolute form.
*
* Converts a relative or absolute path to a fully qualified absolute path.
* Relative paths are resolved against the current working directory.
*
* @param[out] result Buffer to store the absolute path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path Path to convert to absolute form.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - absolute path created successfully.
* @retval DRANG_EINVAL Invalid parameter (result or path is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @retval DRANG_EIO I/O error occurred while resolving current directory.
* @remarks Relative paths are resolved against the current working directory.
* The result is always null-terminated and fully qualified.
*/
DRANG_PLATFORM_API int drang_fs_path_absolute(char *result, size_t result_size, const char *path, size_t *out_size);
/**
* @brief Converts a path to absolute form with explicit length.
*
* Converts a relative or absolute path to a fully qualified absolute path.
* The input path is specified with an explicit length rather than being
* null-terminated. Relative paths are resolved against the current working directory.
*
* @param[out] result Buffer to store the absolute path.
* @param[in] result_size Size of the result buffer in bytes.
* @param[in] path Path to convert to absolute form.
* @param[in] path_length Length of the input path.
* @param[out] out_size Pointer to store the actual result length (may be NULL).
* @return 0 on success, negative error code on failure.
* @retval DRANG_EOK Success - absolute path created successfully.
* @retval DRANG_EINVAL Invalid parameter (result or path is NULL).
* @retval DRANG_ENOMEM Result buffer too small.
* @retval DRANG_EIO I/O error occurred while resolving current directory.
* @remarks Useful when working with non-null-terminated path strings.
* The result is always null-terminated and fully qualified.
*/
DRANG_PLATFORM_API int drang_fs_path_absolute_length(
char *result, size_t result_size, const char *path, size_t path_length, size_t *out_size);
DRANG_END_DECLS