fake_main_t * const main = data->main;
- f_string_static_t buffer = f_string_static_t_initialize;
f_status_t failed = F_okay;
fake_local_t local = macro_fake_local_t_initialize_1(main, &main->cache_map, &failed);
uint8_t func = 0;
}
if (F_status_is_error_not(main->setting.state.status)) {
- if (preserve) {
- func = 3;
- main->setting.state.status = f_file_name_base(files.array[i], &main->cache_map.value);
+ if (preserve && offset < main->cache_map.key.used) {
+ func = 9;
+ main->setting.state.status = f_string_append_nulless(main->cache_map.key.string + offset, main->cache_map.key.used - offset, &main->cache_map.value);
}
else {
- if (offset) {
- buffer.string = files.array[i].string + offset;
- buffer.used = files.array[i].used - offset;
-
- main->setting.state.status = f_string_dynamic_append_nulless(buffer, &main->cache_map.value);
- }
- else {
- main->setting.state.status = f_string_dynamic_append_nulless(files.array[i], &main->cache_map.value);
- }
+ func = 3;
+ main->setting.state.status = f_file_name_base(files.array[i], &main->cache_map.value);
}
}
? macro_fake_f(f_file_name_directory)
: func == 7
? macro_fake_f(fl_directory_create)
- : macro_fake_f(f_file_copy),
+ : func == 8
+ ? macro_fake_f(f_file_copy)
+ : macro_fake_f(f_string_append_nulless),
f_file_operation_copy_s,
main->cache_map.key,
main->cache_map.value,
* @param file_stage
* The specific stage file path.
* @param preserve
- * Set to F_true to preserve the path.
- * Set to F_False to only use the base name when copying.
+ * Set to F_true to preserve the path and offset is used with the source path to construct the destination path.
+ * Set to F_false to only use the file name as the destination.
* @param offset
- * When preserve is F_true, this represents the amount of characters at the front of each path to ignore.
+ * When preserve is F_true, this offset represents the amount of characters at the front of each path to ignore.
* Everything after the offset is preserved, and directories are created if necessary.
+ * The offset must be based on the source string.
*
- * Example: 'sources/c/level_0/fss.h' with a preseve of 10, would result in the path of 'level_0/fss.h' being preserved.
- * Whereas a preseve is F_false, then the path used would instead be 'fss.h' (the 'sources/c/level_0/' directories are not preserved).
+ * Example: 'sources/c/level_0/fss.h' a preserve F_true and an offset of 10 would result in the path of 'level_0/fss.h' being preserved.
+ * Whereas when preseve is F_false, then the path used would instead be 'fss.h' (the 'sources/c/level_0/' directories are not preserved).
*
* @see f_directory_is()
* @see f_file_copy()