mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 10:19:47 +08:00
refactor: 移除未使用的布局配置并增强日志与安全字符串
- 删除未使用的 layout_config.h 头文件及其引用 - 在 main.c 和 callbacks.c 中添加日志记录以追踪程序启动、关闭和关键操作 - 将多处 strncpy 调用替换为安全的 safe_strcpy 函数 - 在 dialogs.c 中引入 safe_string.h 以使用安全字符串函数
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user