Skip to content

Commit 1017633

Browse files
authored
change zip sorting again (#943)
* file_io: sort zips with directories again * menu: strip now-redundant .zip extension, make <ZIP> suffix match <DIR>
1 parent 7e40f55 commit 1017633

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

file_io.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,12 +1224,6 @@ struct DirentComp
12241224
if ((de1.de.d_type == DT_DIR) && (de2.de.d_type != DT_DIR)) return true;
12251225
if ((de1.de.d_type != DT_DIR) && (de2.de.d_type == DT_DIR)) return false;
12261226

1227-
if ((de1.de.d_type == DT_DIR) && (de2.de.d_type == DT_DIR))
1228-
{
1229-
if (!(de1.flags & DT_EXT_ZIP) && (de2.flags & DT_EXT_ZIP)) return true;
1230-
if ((de1.flags & DT_EXT_ZIP) && !(de2.flags & DT_EXT_ZIP)) return false;
1231-
}
1232-
12331227
int len1 = strlen(de1.altname);
12341228
int len2 = strlen(de2.altname);
12351229
if ((len1 > 4) && (de1.altname[len1 - 4] == '.')) len1 -= 4;

menu.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7107,6 +7107,10 @@ void PrintDirectory(int expand)
71077107
{
71087108
strncpy(s + 1, flist_DirItem(k)->altname+1, len-1);
71097109
}
7110+
else if (flist_DirItem(k)->flags & DT_EXT_ZIP)
7111+
{
7112+
strncpy(s + 1, flist_DirItem(k)->altname, len-4); // strip .zip extension, see below
7113+
}
71107114
else
71117115
{
71127116
strncpy(s + 1, flist_DirItem(k)->altname, len); // display only name
@@ -7122,7 +7126,7 @@ void PrintDirectory(int expand)
71227126
else
71237127
{
71247128
if (flist_DirItem(k)->flags & DT_EXT_ZIP) // mark ZIP archive with different suffix
7125-
strcpy(&s[22], " <zip>");
7129+
strcpy(&s[22], " <ZIP>");
71267130
else
71277131
strcpy(&s[22], " <DIR>");
71287132
}

0 commit comments

Comments
 (0)