forked from qt-creator/qt-creator
Utils: Fake root info
When trying to open a FileDialog all roots were tested for existence. This is slow and might show ask-pass. Since "/" can be considered always valid, we create a fake entry for it and only test existence of remote paths if they are not a root path. In the future FilePath should get a "isRoot()" function so we don't just test for == "/". Remove the fileAccess from WebAssembly devices. Change-Id: I7a1a6e7d2025e9fd4428e4bd1d07cdbdb5680c8e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -829,6 +829,19 @@ QByteArray UnixDeviceFileAccess::fileId(const FilePath &filePath) const
|
||||
|
||||
FilePathInfo UnixDeviceFileAccess::filePathInfo(const FilePath &filePath) const
|
||||
{
|
||||
if (filePath.path() == "/") // TODO: Add FilePath::isRoot()
|
||||
{
|
||||
const FilePathInfo r{4096,
|
||||
FilePathInfo::FileFlags(
|
||||
FilePathInfo::ReadOwnerPerm | FilePathInfo::WriteOwnerPerm
|
||||
| FilePathInfo::ExeOwnerPerm | FilePathInfo::ReadGroupPerm
|
||||
| FilePathInfo::ExeGroupPerm | FilePathInfo::ReadOtherPerm
|
||||
| FilePathInfo::ExeOtherPerm | FilePathInfo::DirectoryType
|
||||
| FilePathInfo::LocalDiskFlag | FilePathInfo::ExistsFlag),
|
||||
QDateTime::currentDateTime()};
|
||||
|
||||
return r;
|
||||
}
|
||||
const RunResult stat = runInShell({"stat", {"-L", "-c", "%f %Y %s", filePath.path()}, OsType::OsTypeLinux});
|
||||
return FileUtils::filePathInfoFromTriple(QString::fromLatin1(stat.stdOut));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user