emunand: Implement folder and file detection (boot0/boot1 now work from SD)

This commit is contained in:
hexkyz
2019-04-09 19:32:18 +01:00
parent 5868e0769a
commit fe62ab9aed
12 changed files with 198 additions and 159 deletions

View File

@@ -48,3 +48,21 @@ size_t dump_to_file(const void *src, size_t src_size, const char *filename) {
return sz;
}
}
bool is_valid_folder(const char *path) {
struct stat st;
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
return true;
}
return false;
}
bool is_valid_file(const char *path) {
struct stat st;
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
return true;
}
return false;
}