diff --git a/src/wfcomman.c b/src/wfcomman.c index 29c7108e..28557647 100644 --- a/src/wfcomman.c +++ b/src/wfcomman.c @@ -289,6 +289,45 @@ ChangeFileSystem( dwFSCOperation = FSC_Operation(dwFunction); + // Check if an attribute change refers to a directory. If it does, the + // tree views might want to remove it or insert it based on its new + // hidden/system attributes + if (dwFSCOperation == FSC_ATTRIBUTES) + { + DWORD dwFileAttribs; + DWORD dwFilterAttribs; + + dwFileAttribs = GetFileAttributes(szFrom); + if (dwFileAttribs != INVALID_FILE_ATTRIBUTES && + (dwFileAttribs & ATTR_DIR) != 0) + { + + /* Update the tree. */ + for (hwnd = GetWindow(hwndMDIClient, GW_CHILD); + hwnd != NULL; + hwnd = GetWindow(hwnd, GW_HWNDNEXT)) + { + dwFilterAttribs = (DWORD)GetWindowLongPtr(hwnd, GWL_ATTRIBS); + + // If the view is hiding hidden/system, perform an insert or + // remove based on whether the new attributes include + // hidden/system or not. + if ((dwFilterAttribs & ATTR_HS) == 0 && + (hwndTree = HasTreeWindow(hwnd))) + { + if ((dwFileAttribs & ATTR_HS) == 0) + { + SendMessage(hwndTree, WM_FSC, FSC_MKDIR | FSC_QUIET, (LPARAM)szFrom); + } + else + { + SendMessage(hwndTree, WM_FSC, FSC_RMDIR | FSC_QUIET, (LPARAM)szFrom); + } + } + } + } + } + switch (dwFSCOperation) { case ( FSC_RENAME ) : diff --git a/src/winfile.h b/src/winfile.h index 3f8f04b6..716a07fb 100644 --- a/src/winfile.h +++ b/src/winfile.h @@ -197,7 +197,7 @@ INT atoiW(LPWSTR sz); #define UNDELETE_ENTRYW "UndeleteFileW" #define FILE_NOTIFY_CHANGE_FLAGS (FILE_NOTIFY_CHANGE_FILE_NAME | \ - FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_SIZE) + FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_ATTRIBUTES) #define DwordAlign(cb) (((cb) + 3) & ~3) #define ISDOTDIR(x) (x[0]==CHAR_DOT && (!x[1] || (x[1] == CHAR_DOT && !x[2])))