mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-30 02:25:55 +08:00
cdcfd8e0a7
功能: - 新增 CSV 格式导入导出支持(含 BOM 处理、引号转义、智能标题行检测) - 导入操作支持撤销/重做 - 保存时 PATH 长度检查与警告 - 深色模式状态持久化(darkmode.txt) - 提取 get_current_target/push_record 为共享函数,消除控制器层重复代码 - 新增 string_list_insert_at,修复撤销删除时的索引恢复 - 新增 undo_redo、error_code、import_export 单元测试 Bug 修复: - 修复备份目录对话框和失败原因的硬编码中文字符串 - 提取 get_exe_dir 到 os_env 消除 i18n.c/ui_utils.c 重复定义 - 修复导入撤销 old_sys/old_user 内存管理(push 后置 NULL 防止重复释放) - 修复 CSV 导出转义与导入解析不一致(移除反斜杠转义,依赖 CSV 引号机制) - 修正 PATH 长度 8191 限制描述为 "command line safe limit"
39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#ifndef STRING_EXT_H
|
||
#define STRING_EXT_H
|
||
|
||
#include <wchar.h>
|
||
|
||
// 简单字符串列表结构
|
||
typedef struct
|
||
{
|
||
char **items;
|
||
int count;
|
||
int capacity;
|
||
} StringList;
|
||
|
||
// 字符串列表
|
||
void init_string_list(StringList *list);
|
||
void add_string_list(StringList *list, const char *str);
|
||
int string_list_insert_at(StringList *list, int index, const char *str);
|
||
void clear_string_list(StringList *list);
|
||
|
||
// 访问器函数 - 安全访问内部数据
|
||
// 获取指定索引的字符串(只读),越界返回 NULL
|
||
const char *string_list_get(const StringList *list, int index);
|
||
// 设置指定索引的字符串(会复制新字符串并释放旧字符串),越界返回 -1,成功返回 0
|
||
int string_list_set(StringList *list, int index, const char *str);
|
||
|
||
// 字符串转换函数
|
||
char *wide_to_utf8(const wchar_t *wstr);
|
||
wchar_t *utf8_to_wide(const char *str);
|
||
char *stristr(const char *haystack, const char *needle);
|
||
|
||
// 检查字符串列表中是否存在指定路径(不区分大小写)
|
||
int string_list_contains(const StringList *list, const char *str);
|
||
|
||
// 展开环境变量(如 %JAVA_HOME%\bin → C:\Java\bin)
|
||
// 返回 malloc 分配的字符串,调用者负责释放;无变量返回 NULL
|
||
char *expand_env_vars(const char *path);
|
||
|
||
#endif // STRING_EXT_H
|