Skip to content

Commit

Permalink
Merge pull request elfmz#2538 from exkrexpexfex/master
Browse files Browse the repository at this point in the history
Count symlinks as files
  • Loading branch information
elfmz authored Dec 1, 2024
2 parents 69ba21c + fb4e39f commit 2c03f3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions far2l/src/delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ShellDeleteMsgState
_last_redraw = now;

const int percent = (Opt.DelOpt.DelShowTotal && total != (ULONG)-1)
? (total ? (processed * 100 / total) : 0)
? (total ? ToPercent64(processed, total) : 0)
: -1;

if (percent != -1)
Expand Down Expand Up @@ -353,6 +353,7 @@ static ULONG ShellCalcCountOfItemsToDelete(Panel *SrcPanel, bool Wipe)

SrcPanel->GetSelNameCompat(nullptr, FileAttr);
while (SrcPanel->GetSelNameCompat(&strSelName, FileAttr)) {
ItemsCount++;
if (!(FileAttr & FILE_ATTRIBUTE_REPARSE_POINT)) {
if (FileAttr & FILE_ATTRIBUTE_DIRECTORY) {
if (!SDMS.Update(strSelName, Wipe))
Expand All @@ -366,9 +367,7 @@ static ULONG ShellCalcCountOfItemsToDelete(Panel *SrcPanel, bool Wipe)
<= 0)
return (ULONG)-1;

ItemsCount+= CurrentFileCount + CurrentDirCount + 1;
} else {
ItemsCount++;
ItemsCount+= CurrentFileCount + CurrentDirCount;
}
}
}
Expand Down Expand Up @@ -475,7 +474,7 @@ void ShellDeleteMsg(const wchar_t *Name, bool Wipe, int Percent)
FARString strProgress;
size_t Width = 52;

if (Percent != -1) {
if (Percent > -1) {
size_t Length = Width - 5; // -5 под проценты
size_t CurPos = Min(Percent, 100) * Length / 100;
strProgress.Reserve(Length);
Expand Down
2 changes: 2 additions & 0 deletions far2l/src/dirinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ int GetDirInfo(const wchar_t *Title, const wchar_t *DirName, uint32_t &DirCount,
if (sdc_lstat(strFullName.GetMB().c_str(), &s) == 0 && !Opt.OnlyFilesSize) {
FileSize+= s.st_size;
}

FileCount++;
if (!ScTree.IsSymlinksScanEnabled())
continue;
}
Expand Down

0 comments on commit 2c03f3a

Please sign in to comment.