practically the whole thing up and running. I should make commits more often...
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user