Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make volume labels distinguishable from files #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.)
  • Loading branch information
unterwulf committed May 5, 2018
commit c9dadf8a779cc729f05cbb97991508a0bd57bb4a
5 changes: 5 additions & 0 deletions src/core/FatEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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;
Expand Down
2 changes: 2 additions & 0 deletions src/core/FatEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -32,6 +33,7 @@ class FatEntry

string getFilename();
bool isDirectory();
bool isVolumeId();
bool isHidden();
bool isErased();

Expand Down
2 changes: 2 additions & 0 deletions src/core/FatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ void FatSystem::list(vector<FatEntry> &entries)

if (entry.isDirectory()) {
printf("d");
} else if (entry.isVolumeId()) {
printf("v");
} else {
printf("f");
}
Expand Down