File 0002-Make-volume-labels-distinguishable-from-files.patch of Package fatcat
From c9dadf8a779cc729f05cbb97991508a0bd57bb4a Mon Sep 17 00:00:00 2001
From: Vitaly Sinilin <vs@kp4.ru>
Date: Sat, 5 May 2018 21:24:32 +0300
Subject: [PATCH] Make volume labels distinguishable from files
So they could be easily filtered out by a parser if needed.
(This is required to make a fatcat extfs helper for Midnight
Commander.)
[Rebased by Arachnos]
---
src/core/FatEntry.cpp | 5 +++++
src/core/FatEntry.h | 2 ++
src/core/FatSystem.cpp | 2 ++
3 files changed, 9 insertions(+)
diff --git a/src/core/FatEntry.cpp b/src/core/FatEntry.cpp
index e07a8fa..9aa5f1e 100644
--- a/src/core/FatEntry.cpp
+++ b/src/core/FatEntry.cpp
@@ -62,6 +62,11 @@ bool FatEntry::isDirectory()
return attributes&FAT_ATTRIBUTES_DIR;
}
+bool FatEntry::isVolumeId()
+{
+ return attributes&FAT_ATTRIBUTES_VOLUME_ID;
+}
+
bool FatEntry::isHidden()
{
return attributes&FAT_ATTRIBUTES_HIDE;
diff --git a/src/core/FatEntry.h b/src/core/FatEntry.h
index 66f3b8d..310f4e3 100644
--- a/src/core/FatEntry.h
+++ b/src/core/FatEntry.h
@@ -19,6 +19,7 @@ using namespace std;
// Attributes
#define FAT_ATTRIBUTES_HIDE (1<<1)
#define FAT_ATTRIBUTES_DIR (1<<4)
+#define FAT_ATTRIBUTES_VOLUME_ID 0x8
#define FAT_ATTRIBUTES_LONGFILE (0xf)
#define FAT_ATTRIBUTES_FILE (0x20)
@@ -33,6 +34,7 @@ class FatEntry
string getFilename();
string getShortFilename();
bool isDirectory();
+ bool isVolumeId();
bool isHidden();
bool isErased();
diff --git a/src/core/FatSystem.cpp b/src/core/FatSystem.cpp
index 43f7912..74bc541 100644
--- a/src/core/FatSystem.cpp
+++ b/src/core/FatSystem.cpp
@@ -550,6 +550,8 @@ void FatSystem::list(vector<FatEntry> &entries)
if (entry.isDirectory()) {
printf("d");
+ } else if (entry.isVolumeId()) {
+ printf("v");
} else {
printf("f");
}
--
2.33.0