mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Check UNC path to avoid "hanging" if other machine is not reachable
This commit is contained in:
committed by
Mat Sutcliffe
parent
04562a6651
commit
e839820940
@@ -506,6 +506,31 @@ namespace BlackMisc
|
||||
return f.left(i);
|
||||
}
|
||||
|
||||
QSet<QString> CFileUtils::windowsUncMachines(const QSet<QString> &paths)
|
||||
{
|
||||
if (paths.isEmpty()) { return {}; }
|
||||
|
||||
const Qt::CaseSensitivity cs = osFileNameCaseSensitivity();
|
||||
const bool isCs = isFileNameCaseSensitive();
|
||||
|
||||
QSet<QString> machines;
|
||||
QString lastMachine;
|
||||
|
||||
for (const QString &p : paths)
|
||||
{
|
||||
if (!lastMachine.isEmpty() && p.contains(lastMachine, cs))
|
||||
{
|
||||
// shortcut
|
||||
continue;
|
||||
}
|
||||
const QString m = isCs ? windowsUncMachine(p) : windowsUncMachine(p).toLower();
|
||||
if (m.isEmpty()) { continue; }
|
||||
lastMachine = m;
|
||||
machines.insert(m);
|
||||
}
|
||||
return machines;
|
||||
}
|
||||
|
||||
bool CFileUtils::canPingUncMachine(const QString &machine)
|
||||
{
|
||||
static QMap<QString, qint64> good;
|
||||
|
||||
Reference in New Issue
Block a user