feat: expose drive labels to userspace, render in Files
This commit is contained in:
@@ -208,6 +208,38 @@ namespace Fs::Vfs {
|
||||
return count;
|
||||
}
|
||||
|
||||
int VfsDriveLabel(int driveNumber, char* outLabel, int maxLen) {
|
||||
if (outLabel == nullptr || maxLen <= 0) return -1;
|
||||
outLabel[0] = '\0';
|
||||
|
||||
vfsLock.Acquire();
|
||||
if (driveNumber < 0 || driveNumber >= MaxDrives || driveTable[driveNumber] == nullptr) {
|
||||
vfsLock.Release();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (driveTable[driveNumber]->GetLabel == nullptr) {
|
||||
vfsLock.Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* label = driveTable[driveNumber]->GetLabel();
|
||||
if (label == nullptr || label[0] == '\0') {
|
||||
vfsLock.Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int copied = 0;
|
||||
while (label[copied] != '\0' && copied < maxLen - 1) {
|
||||
outLabel[copied] = label[copied];
|
||||
copied++;
|
||||
}
|
||||
outLabel[copied] = '\0';
|
||||
|
||||
vfsLock.Release();
|
||||
return copied;
|
||||
}
|
||||
|
||||
int VfsRename(const char* oldPath, const char* newPath) {
|
||||
int oldDrive, newDrive;
|
||||
const char* oldLocal;
|
||||
|
||||
Reference in New Issue
Block a user