refactor(core): 统一使用ErrorCode并添加错误日志记录

- 将path_manager和import_export模块的返回值从int/void改为ErrorCode
- 在关键操作中添加日志记录,便于调试和错误追踪
- 更新调用代码以检查错误码并记录错误
- 修改运行命令以管理员权限启动程序
This commit is contained in:
2026-03-26 18:27:38 +08:00
parent 3af0e96060
commit 9a78b88c4a
6 changed files with 80 additions and 38 deletions
+4 -3
View File
@@ -2,6 +2,7 @@
#define IMPORT_EXPORT_H
#include "utils/string_ext.h"
#include "utils/error_code.h"
#define EXPORT_VERSION "1.0"
@@ -11,9 +12,9 @@ typedef struct {
} ExportData;
// 导出 PATH 到文件
int export_paths_to_file(const ExportData *data, const char *filepath);
ErrorCode export_paths_to_file(const ExportData *data, const char *filepath);
// 从文件导入 PATH (返回是否包含全部格式)
int import_paths_from_file(const char *filepath, ExportData *data);
// 从文件导入 PATH
ErrorCode import_paths_from_file(const char *filepath, ExportData *data);
#endif // IMPORT_EXPORT_H
+5 -5
View File
@@ -2,18 +2,18 @@
#define PATH_MANAGER_H
#include "utils/string_ext.h"
#include "utils/error_code.h"
// 移除列表中指定索引的项
void path_manager_remove_at(StringList *list, int index);
ErrorCode path_manager_remove_at(StringList *list, int index);
// 上移指定索引的项
void path_manager_move_up(StringList *list, int index);
ErrorCode path_manager_move_up(StringList *list, int index);
// 下移指定索引的项
void path_manager_move_down(StringList *list, int index);
ErrorCode path_manager_move_down(StringList *list, int index);
// 清理无效和重复的路径
// 返回被清理的项数
int path_manager_clean(StringList *list);
ErrorCode path_manager_clean(StringList *list);
#endif // PATH_MANAGER_H