diff --git a/src/core/FatEntry.cpp b/src/core/FatEntry.cpp index e07a8fa..e7258e2 100644 --- a/src/core/FatEntry.cpp +++ b/src/core/FatEntry.cpp @@ -34,22 +34,27 @@ string FatEntry::getFilename() if (longName != "") { return longName; } else { - string name; - string ext = trim(shortName.substr(8,3)); - string base = trim(shortName.substr(0,8)); + return getShortFilename(); + } +} - if (isErased()) { - base = base.substr(1); - } +string FatEntry::getShortFilename() +{ + string name; + string ext = trim(shortName.substr(8,3)); + string base = trim(shortName.substr(0,8)); - name = base; + if (isErased()) { + base = base.substr(1); + } - if (ext != "") { - name += "." + ext; - } + name = base; - return name; + if (ext != "") { + name += "." + ext; } + + return name; } bool FatEntry::isDirectory() diff --git a/src/core/FatEntry.h b/src/core/FatEntry.h index 66f3b8d..cd69ee1 100644 --- a/src/core/FatEntry.h +++ b/src/core/FatEntry.h @@ -31,6 +31,7 @@ class FatEntry FatEntry(); string getFilename(); + string getShortFilename(); bool isDirectory(); bool isHidden(); bool isErased(); diff --git a/src/core/FatSystem.cpp b/src/core/FatSystem.cpp index 37be51c..79cda8c 100644 --- a/src/core/FatSystem.cpp +++ b/src/core/FatSystem.cpp @@ -510,9 +510,11 @@ void FatSystem::list(vector &entries) } string name = entry.getFilename(); + string shrtname = entry.getShortFilename(); cout << "\"EditDate\":\"" << entry.changeDate.isoFormat() << "\","; cout << "\"Name\":\"" << name << "\","; + cout << "\"8DOT3Name\":\"" << shrtname << "\","; cout << "\"Cluster\":" << entry.cluster << ","; if (!entry.isDirectory()) { @@ -557,8 +559,13 @@ void FatSystem::list(vector &entries) name += "/"; } + string shrtname = entry.getShortFilename(); + if (name.compare(shrtname)) { + name += " (" + shrtname + ")"; + } + printf(" %s ", entry.changeDate.pretty().c_str()); - printf(" %-30s", name.c_str()); + printf(" %-50s", name.c_str()); printf(" c=%u", entry.cluster);