feat: expose drive labels to userspace, render in Files

This commit is contained in:
2026-04-22 07:45:33 +02:00
parent 38b1f8a7ef
commit 7fa2b6c54b
20 changed files with 261 additions and 38 deletions
+32
View File
@@ -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;