Skip to content

Commit

Permalink
Linux build fixed; minor CPanelWidget mutex refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletGiraffe committed Apr 4, 2019
1 parent e656d27 commit f71b84b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -193,3 +193,5 @@ Makefile.Release
.qmake.stash
*.dmg
.DS_Store

*.8-pre1
20 changes: 15 additions & 5 deletions file-commander-core/src/cpanel.cpp
Expand Up @@ -258,14 +258,24 @@ void CPanel::refreshFileList(FileListRefreshCause operation)
_workerThreadPool.enqueue([this, operation]() {
QFileInfoList list;

bool currentPathIsAccessible = false;
QString currentDirPath;

{
std::lock_guard<std::recursive_mutex> locker(_fileListAndCurrentDirMutex);

if (!pathIsAccessible(_currentDirObject.fullAbsolutePath()))
{
setPath(_currentDirObject.fullAbsolutePath(), operation); // setPath will itself find the closest best folder to set instead
return;
}
currentDirPath = _currentDirObject.fullAbsolutePath();
currentPathIsAccessible = pathIsAccessible(currentDirPath);
}

if (!currentPathIsAccessible)
{
setPath(currentDirPath, operation); // setPath will itself find the closest best folder to set instead
return;
}

{
std::lock_guard<std::recursive_mutex> locker(_fileListAndCurrentDirMutex);

list = _currentDirObject.qDir().entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDot | QDir::Hidden | QDir::System);
_items.clear();
Expand Down
4 changes: 4 additions & 0 deletions file-commander-core/src/diskenumerator/volumeinfohelper.hpp
Expand Up @@ -12,6 +12,10 @@ RESTORE_COMPILER_WARNINGS
#include <sys/mount.h>
#include <errno.h>

#ifdef __linux__
#include <sys/vfs.h> // statfs64
#endif

inline struct statfs64 volumeInfoForPath(const QString& path)
{
struct statfs64 info;
Expand Down

0 comments on commit f71b84b

Please sign in to comment.