use older stat tools. TurboC doesn't know what S_ISDIR is
Some checks failed
Build / build (push) Failing after 32s
Some checks failed
Build / build (push) Failing after 32s
This commit is contained in:
parent
602f941dd3
commit
b54f0119fc
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,5 @@
|
|||||||
.grok/
|
.grok/
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.DS_Store
|
||||||
build/
|
build/
|
||||||
|
|||||||
@ -11,8 +11,8 @@ int ensure_directory_exists(const char *path) {
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(path, &st) == 0) {
|
if (stat(path, &st) == 0) {
|
||||||
/* Path exists, check if it's a directory */
|
/* Path exists, check if it's a directory using bit test */
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if ((st.st_mode & S_IFMT) == S_IFDIR) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error: %s exists but is not a directory\n", path);
|
fprintf(stderr, "Error: %s exists but is not a directory\n", path);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user