f_char_t tree_string[path.used + 1];
tree.string = tree_string;
- tree.used = path.used;
tree_string[path.used] = 0;
for (; at_path < path.used; ++at_path) {
if (at_path && path.string[at_path] == f_path_separator_s.string[0]) {
- memcpy(tree.string, path.string + at_tree, sizeof(f_char_t) * (at_path - at_tree));
- tree.string[at_path - at_tree] = 0;
+ memcpy(tree.string + at_tree, path.string + at_tree, sizeof(f_char_t) * (at_path - at_tree));
+ tree.string[at_path] = 0;
+ tree.used = at_path;
status = f_directory_exists(tree);
if (F_status_is_error(status)) return status;
- if (status == F_false) {
+ if (status == F_false || status == F_file_found_not) {
status = f_directory_create(tree, mode);
if (F_status_is_error(status)) return status;
}