From fc820c883938e7daa257820c818a5c6b609f755f Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Mon, 27 Mar 2023 06:49:10 +0200 Subject: Path delim macro --- include/kit.inl.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/kit.inl.h b/include/kit.inl.h index 287765a..873e0bf 100644 --- a/include/kit.inl.h +++ b/include/kit.inl.h @@ -364,10 +364,12 @@ extern "C" { #endif #if defined(_WIN32) && !defined(__CYGWIN__) -# define KIT_PATH_DELIM '\\' +# define KIT_PATH_DELIM_C '\\' +# define KIT_PATH_DELIM "\\" # define KIT_ENV_HOME "USERPROFILE" #else -# define KIT_PATH_DELIM '/' +# define KIT_PATH_DELIM_C '/' +# define KIT_PATH_DELIM "/" # define KIT_ENV_HOME "HOME" #endif @@ -443,6 +445,10 @@ void kit_path_list_destroy(kit_path_list_t list); # define file_enum_folder kit_file_enum_folder # define path_list_destroy kit_path_list_destroy +# define PATH_DELIM_C KIT_PATH_DELIM_C +# define PATH_DELIM KIT_PATH_DELIM +# define ENV_HOME KIT_ENV_HOME + # define PATH_NONE KIT_PATH_NONE # define PATH_FILE KIT_PATH_FILE # define PATH_FOLDER KIT_PATH_FOLDER @@ -717,7 +723,7 @@ kit_string_t kit_path_norm(kit_str_t const path, for (i = 0; i < norm.size; i++) { if (norm.values[i] != '\0') { if (is_delim(norm.values[i])) - norm.values[size] = KIT_PATH_DELIM; + norm.values[size] = KIT_PATH_DELIM_C; else norm.values[size] = norm.values[i]; size++; @@ -750,7 +756,7 @@ kit_string_t kit_path_join(kit_str_t const left, return joined; memcpy(joined.values, left.values, left_size); - joined.values[left_size] = KIT_PATH_DELIM; + joined.values[left_size] = KIT_PATH_DELIM_C; memcpy(joined.values + left_size + 1, right_values, right_size); return joined; -- cgit v1.2.3