refactor: 移除未使用的布局配置并增强日志与安全字符串

- 删除未使用的 layout_config.h 头文件及其引用
- 在 main.c 和 callbacks.c 中添加日志记录以追踪程序启动、关闭和关键操作
- 将多处 strncpy 调用替换为安全的 safe_strcpy 函数
- 在 dialogs.c 中引入 safe_string.h 以使用安全字符串函数
This commit is contained in:
2026-03-26 13:20:34 +08:00
parent 6ba7e702f2
commit 3af0e96060
5 changed files with 28 additions and 27 deletions
+9
View File
@@ -7,6 +7,7 @@
#include "core/lua_config.h"
#include "utils/string_ext.h"
#include "utils/os_env.h"
#include "utils/logger.h"
#include "controller/callbacks.h"
#include "ui/main_window.h"
@@ -33,6 +34,10 @@ build\\PathEditor.exe
// 主函数
int main(int argc, char **argv)
{
// 初始化日志系统
log_init(NULL, LOG_LEVEL_INFO);
log_info("PathEditor starting...");
// 强制设置 UTF8MODE 环境变量,必须在 IupOpen 之前
putenv("IUP_UTF8MODE=YES");
@@ -44,6 +49,8 @@ int main(int argc, char **argv)
IupMessage("警告", "Lua 配置系统初始化失败,将使用默认值");
}
log_info("Lua config initialized");
// 在管理员模式下,解决无法拖拽文件到列表框的问题 (UIPI)
// 需要加载 User32.dll 获取 ChangeWindowMessageFilter 函数
HMODULE hUser32 = LoadLibraryW(L"user32.dll");
@@ -132,8 +139,10 @@ int main(int argc, char **argv)
IupMainLoop();
log_info("PathEditor exiting...");
destroy_app_context(ctx);
lua_config_destroy();
log_destroy();
IupClose();
return 0;