mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 09:59:18 +01:00
starting get/set for DOS file attributes
This commit is contained in:
parent
151670c8a6
commit
84dd3a491a
@ -45,6 +45,37 @@
|
||||
#include "filetime.h"
|
||||
#include "lock.h"
|
||||
|
||||
bool _FAT_findEntry(const char *path, DIR_ENTRY *dirEntry) {
|
||||
PARTITION *partition = _FAT_partition_getPartitionFromPath(path);
|
||||
|
||||
// Move the path pointer to the start of the actual path
|
||||
if (strchr (path, ':') != NULL) {
|
||||
path = strchr (path, ':') + 1;
|
||||
}
|
||||
if (strchr (path, ':') != NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search for the file on the disc
|
||||
return _FAT_directory_entryFromPath (partition, dirEntry, path, NULL);
|
||||
|
||||
}
|
||||
|
||||
int FAT_getAttr(const char *file) {
|
||||
DIR_ENTRY dirEntry;
|
||||
if (!_FAT_findEntry(file,&dirEntry)) return -1;
|
||||
|
||||
return dirEntry.entryData[DIR_ENTRY_attributes];
|
||||
}
|
||||
|
||||
int FAT_setAttr(const char *file, int attr) {
|
||||
DIR_ENTRY dirEntry;
|
||||
if (!_FAT_findEntry(file,&dirEntry)) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode) {
|
||||
PARTITION* partition = NULL;
|
||||
bool fileExists;
|
||||
|
Loading…
Reference in New Issue
Block a user