]> git.sesse.net Git - nageru/commitdiff
Create frames/ if it does not exist.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Oct 2018 18:47:56 +0000 (20:47 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Oct 2018 18:47:56 +0000 (20:47 +0200)
main.cpp

index bf9757533fa5a1fd7d46473e9c411ec70c9f5663..04a7d54ddc43f75491c5edd8175aa7a5e0c86a5a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -9,6 +9,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <thread>
 #include <vector>
@@ -75,6 +76,17 @@ int main(int argc, char **argv)
                exit(1);
        }
 
+       string frame_dir = global_flags.working_directory + "/frames";
+
+       struct stat st;
+       if (stat(frame_dir.c_str(), &st) == -1) {
+               fprintf(stderr, "%s does not exist, creating it.\n", frame_dir.c_str());
+               if (mkdir(frame_dir.c_str(), 0777) == -1) {
+                       perror(global_flags.working_directory.c_str());
+                       exit(1);
+               }
+       }
+
        avformat_network_init();
        global_httpd = new HTTPD;