#include "mag_hal.h"
#endif
+#include <sys/stat.h>
+
errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg)
{
if (task_cfg==NULL)
}
}
+
+bool uapi_create_dir(const char *path)
+{
+ if (path == NULL || strlen(path) == 0) {
+ PRINT("[DirCreate] ERROR: Invalid path (NULL or empty)\n");
+ return false;
+ }
+
+ PRINT("[DirCreate] Checking directory: %s\n", path);
+
+ struct stat info;
+ // 检查目录是否存在
+ if (stat(path, &info) != 0) {
+ PRINT("[DirCreate] Directory does not exist, creating...\n");
+
+ // 目录不存在,尝试创建
+ if (mkdir(path, 0755) != 0) {
+ // 创建失败,打印错误信息
+ PRINT("[DirCreate] ERROR: Failed to create directory %s (errno=%d)\n", path, errno);
+ return false;
+ }
+
+ PRINT("[DirCreate] SUCCESS: Directory created: %s\n", path);
+ return true;
+ }
+
+ // 检查是否为目录
+ if (info.st_mode & S_IFDIR) {
+ PRINT("[DirCreate] Directory already exists: %s\n", path);
+ return true;
+ }
+
+ return false;
+}
+
+
// Is the screen always on
bool mmi_screen_always_on_flag_get(void)
{