From: Steinar H. Gunderson Date: Fri, 19 Oct 2018 18:47:56 +0000 (+0200) Subject: Create frames/ if it does not exist. X-Git-Tag: 1.8.0~76^2~54 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=5f64e5a2eef0c415e218d71877fe4936a93589f4;p=nageru Create frames/ if it does not exist. --- diff --git a/main.cpp b/main.cpp index bf97575..04a7d54 100644 --- a/main.cpp +++ b/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -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;