2021-01-27 16:13:06 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2021-01-27 21:26:19 +00:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-01-27 16:13:06 +00:00
|
|
|
|
2022-06-25 21:30:08 +00:00
|
|
|
#include <mods/home/home.h>
|
|
|
|
#include <mods/init/init.h>
|
2021-01-27 16:13:06 +00:00
|
|
|
|
|
|
|
void run_tests() {
|
2021-02-10 20:47:38 +00:00
|
|
|
// Test ~/.minecraft-pi Permissions
|
2021-01-31 02:32:20 +00:00
|
|
|
{
|
2021-06-17 21:32:24 +00:00
|
|
|
char *path = home_get();
|
|
|
|
int exists = access(path, F_OK) == 0;
|
|
|
|
int can_write = exists ? access(path, R_OK | W_OK) == 0 : 1;
|
2021-01-31 02:32:20 +00:00
|
|
|
|
2021-06-17 21:32:24 +00:00
|
|
|
if (!can_write) {
|
2021-01-27 16:13:06 +00:00
|
|
|
// Failure
|
2022-04-15 01:12:42 +00:00
|
|
|
ERR("Invalid Data Directory Permissions");
|
2021-01-27 16:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-17 21:32:24 +00:00
|
|
|
}
|