libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

mkparents.c (574B)


      1 //
      2 
      3 #include "../release/libsheepyObject.h"
      4 
      5 #define internal static
      6 
      7 
      8 #ifndef unitTest
      9 #endif
     10 int MAIN(int ARGC, char** ARGV);
     11 
     12 int argc; char **argv;
     13 
     14 #ifndef unitTest
     15 // Remove main when running the unit tests
     16 #define MAIN   main
     17 #endif
     18 int MAIN(int ARGC, char** ARGV) {
     19   int dummy UNUSED;
     20 
     21   argc = ARGC; argv = ARGV;;// create dir when it doesnt already exists
     22 
     23   if (ARGC < 2) {
     24     puts(BLD RED "Usage: " RST "mkparents path");
     25     XFAILURE
     26   }
     27 
     28   char *path = ARGV[1];
     29   char *p    = normalizePath(path);
     30   if (!fileExists(p)) {
     31     pError0(mkdirParents(p));
     32 }
     33   }