practically the whole thing up and running. I should make commits more often...

This commit is contained in:
Odweta
2023-12-27 16:14:07 +01:00
parent 7d64937966
commit d5802dd341
14 changed files with 500 additions and 2 deletions
+30
View File
@@ -0,0 +1,30 @@
#include "../include/run.h"
#include <stdio.h>
#include <stdlib.h>
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
printf("Project not yet built. Build it first with 'vendetta build'.\n");
exit(1);
}
}