#include "../include/run.h" #include "../include/build.h" #include #include int get_build_status() { FILE *fd = fopen("./build/.build_status", "r"); if (!fd) { fprintf(stderr, "Build the project before running it.\n"); exit(1); } int i; fscanf(fd, "%d", &i); fclose(fd); return i; // max 10 codes (so far only 2 => 0 -> success, 1 -> failure) } void run_project() { if (get_build_status() == 0) { // success // file exists => project has been built system("make run"); } else { // file does not exist => project has not been built build_project(); run_project(); } }