X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b439ec143c4d2e2daf4b0a9c332123f24500cd9a..38615191e71744b066425e0c44412b62dbe49cc2:/sbr/utils.c?ds=sidebyside diff --git a/sbr/utils.c b/sbr/utils.c index 64df443b..87d368dd 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -120,6 +120,29 @@ add (char *s2, char *s1) return cp; } +/* + * folder_exists + * Check to see if a folder exists. + */ +int folder_exists(char *folder) +{ + struct stat st; + int exists = 0; + + if (stat (folder, &st) == -1) { + /* The folder either doesn't exist, or we hit an error. Either way + * return a failure. + */ + exists = 0; + } else { + /* We can see a folder with the right name */ + exists = 1; + } + + return exists; +} + + /* * create_folder * Check to see if a folder exists, if not, prompt the user to create