diff --git a/include/chsrc.h b/include/chsrc.h index ad35128..a9d2e9b 100644 --- a/include/chsrc.h +++ b/include/chsrc.h @@ -633,33 +633,14 @@ static void chsrc_ensure_dir (const char *dir) { dir = xy_uniform_path (dir); - char *mkdir_cmd = NULL; - if (xy_on_windows) + if (xy_dir_exist (dir)) { - // 也可以用 opendir() #include - DWORD attr = GetFileAttributesA(dir); - - if (attr == INVALID_FILE_ATTRIBUTES) - { - // Q: 我们应该报错吗? - // chsrc_error ("目录路径错误"); - // exit (Exit_MatinerIssue); - } - else - { - if (attr & FILE_ATTRIBUTE_DIRECTORY) - return; - } - } - else - { - int status = system (xy_2strjoin ("test -d ", dir)); - if (0==status) - return; + return; } // 不存在就生成 + char *mkdir_cmd = NULL; if (xy_on_windows) { mkdir_cmd = "md "; // 已存在时返回 errorlevel = 1