Skip to content

Commit 7d378bf

Browse files
committed
Fix Deleting empty subfolders
1 parent c52a39d commit 7d378bf

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/CmdLineContextMenu.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
// fixed SetDateTime for folders
2929
// Version 1.8.0 (c) 2023 thomas694
3030
// added drop handler for copy/move items to target folder
31+
// Version 1.8.1 (c) 2023 thomas694
32+
// fixed deleting empty subfolders
3133
//
3234
// DFTContextMenuHandler is free software: you can redistribute it and/or modify
3335
// it under the terms of the GNU General Public License as published by
@@ -1540,12 +1542,6 @@ void CCmdLineContextMenu::DeleteEmptySubfolders(string baseFolder)
15401542
m_strBaseFolder = baseFolder;
15411543

15421544
CheckSubfolders(baseFolder);
1543-
1544-
for (size_t i = 0; i < m_lstFolders.size(); i++)
1545-
{
1546-
RemoveDirectory(m_lstFolders[i].c_str());
1547-
}
1548-
15491545
}
15501546

15511547
bool CCmdLineContextMenu::CheckSubfolders(string folder)
@@ -1594,7 +1590,12 @@ bool CCmdLineContextMenu::CheckSubfolders(string folder)
15941590
{
15951591
bool isEmpty = CheckSubfolders(lstSubfolders[i].c_str());
15961592
if (isEmpty) {
1597-
m_lstFolders.push_back(lstSubfolders[i].c_str());
1593+
DWORD attributes = GetFileAttributes(lstSubfolders[i].c_str());
1594+
if ((attributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 0) {
1595+
attributes = attributes & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
1596+
SetFileAttributes(lstSubfolders[i].c_str(), attributes);
1597+
}
1598+
RemoveDirectory(lstSubfolders[i].c_str());
15981599
}
15991600
else if (m_strBaseFolder.compare(folder) != 0) {
16001601
ret = false;

src/CmdLineExt.rc

0 Bytes
Binary file not shown.

src/app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
22
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3-
<assemblyIdentity type='win32' name='DFTContextMenuHandler' version='1.8.0.0' processorArchitecture="amd64" />
3+
<assemblyIdentity type='win32' name='DFTContextMenuHandler' version='1.8.1.0' processorArchitecture="amd64" />
44
<asmv3:application>
55
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
66
<ws2:longPathAware>true</ws2:longPathAware>

0 commit comments

Comments
 (0)