fixed fs shit

This commit is contained in:
IonutParau 2025-06-29 16:13:18 +02:00
parent c08e23dc74
commit a0023469df
2 changed files with 19 additions and 3 deletions

View File

@ -162,7 +162,7 @@ void nn_fs_lastModified(nn_filesystem *fs, void *_, nn_component *component, nn_
return;
}
nn_return(computer, nn_values_integer(fs->remove(component, fs->userdata, path)));
nn_return(computer, nn_values_integer(fs->lastModified(component, fs->userdata, path)));
nn_fs_readCost(fs, 1, component, computer);
}

View File

@ -193,6 +193,22 @@ char **ne_fs_list(nn_component *component, ne_fs *fs, const char *path, size_t *
return buf;
}
size_t ne_fs_size(nn_component *component, ne_fs *fs, const char *path) {
const char *p = ne_fs_diskPath(component, path);
if(p[0] == '/') p++;
if(DirectoryExists(p)) return 0;
return GetFileLength(p);
}
size_t ne_fs_lastModified(nn_component *component, ne_fs *fs, const char *path) {
const char *p = ne_fs_diskPath(component, path);
if(p[0] == '/') p++;
return GetFileModTime(p);
}
bool ne_fs_isDirectory(nn_component *component, ne_fs *fs, const char *path) {
const char *p = ne_fs_diskPath(component, path);
if(p[0] == '/') p++;
@ -488,9 +504,9 @@ int main() {
.spaceUsed = ne_fs_spaceUsed,
.spaceTotal = ne_fs_spaceTotal,
.isReadOnly = ne_eeprom_isReadonly,
.size = NULL,
.size = (void *)ne_fs_size,
.remove = NULL,
.lastModified = NULL,
.lastModified = (void *)ne_fs_lastModified,
.rename = NULL,
.exists = (void *)ne_fs_exists,
.isDirectory = (void *)ne_fs_isDirectory,