Skip to content

Commit

Permalink
?
Browse files Browse the repository at this point in the history
  • Loading branch information
PKD667 committed May 2, 2024
1 parent 00b3f13 commit 38f286b
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ char** ls(char* path)
return list;
}


int xisdir (const char *d)
{

DIR* dirptr;

if (access ( d, F_OK ) == 0 ) {
// file exists
if ((dirptr = opendir (d)) != NULL) {
closedir (dirptr); /* d exists and is a directory */
return 0;
} else {
return 2; /* d exists but is not a directory */
}
} else {
return 1; /* d does not exist */
}

}



int pmkdir (const char *dir)
{
char parent_path[strlen(dir)];
Expand Down Expand Up @@ -129,4 +107,25 @@ int rmrf(char *path) {
free(full_path);
}
return rmdir(path);
}
}

int xisdir (const char *d)
{

DIR* dirptr;

if (access ( d, F_OK ) == 0 ) {
// file exists
if ((dirptr = opendir (d)) != NULL) {
closedir (dirptr); /* d exists and is a directory */
return 0;
} else {
return 2; /* d exists but is not a directory */
}
} else {
return 1; /* d does not exist */
}

}


0 comments on commit 38f286b

Please sign in to comment.