]> Kevux Git Server - fll/commitdiff
Bugfix: Controller is adding an extra '/' to the file name.
authorKevin Day <Kevin@kevux.org>
Fri, 12 Jul 2024 03:55:51 +0000 (22:55 -0500)
committerKevin Day <Kevin@kevux.org>
Fri, 12 Jul 2024 03:55:51 +0000 (22:55 -0500)
This does not cause a problem unless the local filesystem is very picky about extra slashes.

The error printing revealed the problem as descibed in the examples below.

Example Incorrect Error Message:
  ERROR: Unable to open file './/entries/utility.entry', could not find.

Example Correct Error Message:
  ERROR: Unable to open file './entries/utility.entry', could not find.

level_3/controller/c/controller/private-controller.c

index c9e2f16ba5f26473e930977c1449e51f314630c3..3e6a74e31ef8eb2e1a35e836cca8ef2e3bb24095 100644 (file)
@@ -68,7 +68,11 @@ extern "C" {
     f_string_static_t path = f_string_static_t_initialize;
 
     if (global.setting->path_setting.used) {
-      path.used = global.setting->path_setting.used + F_path_separator_s_length + cache->action.name_file.used;
+      path.used = global.setting->path_setting.used + cache->action.name_file.used;
+
+      if (global.setting->path_setting.string[global.setting->path_setting.used - 1] != f_path_separator_s.string[0]) {
+        path.used += f_path_separator_s.used;
+      }
     }
     else {
       path.used = cache->action.name_file.used;
@@ -79,9 +83,15 @@ extern "C" {
 
     if (global.setting->path_setting.used) {
       memcpy(path_string, global.setting->path_setting.string, sizeof(f_char_t) * global.setting->path_setting.used);
-      memcpy(path_string + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
 
-      path_string[global.setting->path_setting.used] = f_path_separator_s.string[0];
+      if (global.setting->path_setting.string[global.setting->path_setting.used - 1] == f_path_separator_s.string[0]) {
+        memcpy(path_string + global.setting->path_setting.used, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
+      }
+      else {
+        memcpy(path_string + global.setting->path_setting.used + F_path_separator_s_length, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
+
+        path_string[global.setting->path_setting.used] = f_path_separator_s.string[0];
+      }
     }
     else {
       memcpy(path_string, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);