diff options
Diffstat (limited to 'src/libs/utils/pathchooser.cpp')
-rw-r--r-- | src/libs/utils/pathchooser.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 53825931b9..1fe1e96256 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -10,8 +10,8 @@ #include "hostosinfo.h" #include "macroexpander.h" #include "optionpushbutton.h" +#include "process.h" #include "qtcassert.h" -#include "qtcprocess.h" #include "utilstr.h" #include <QFileDialog> @@ -130,7 +130,7 @@ QString BinaryVersionToolTipEventFilter::toolVersion(const CommandLine &cmd) { if (cmd.executable().isEmpty()) return QString(); - QtcProcess proc; + Process proc; proc.setTimeoutS(1); proc.setCommand(cmd); proc.runBlocking(); @@ -171,7 +171,7 @@ public: FilePath m_initialBrowsePathOverride; QString m_defaultValue; FilePath m_baseDirectory; - EnvironmentChange m_environmentChange; + Environment m_environment; BinaryVersionToolTipEventFilter *m_binaryVersionToolTipEventFilter = nullptr; QList<QAbstractButton *> m_buttons; const MacroExpander *m_macroExpander = globalMacroExpander(); @@ -196,8 +196,7 @@ FilePath PathChooserPrivate::expandedPath(const FilePath &input) const FilePath path = input; - Environment env = path.deviceEnvironment(); - m_environmentChange.applyToEnvironment(env); + Environment env = m_environment.appliedToEnvironment(path.deviceEnvironment()); path = env.expandVariables(path); if (m_macroExpander) @@ -324,20 +323,15 @@ void PathChooser::setBaseDirectory(const FilePath &base) triggerChanged(); } -void PathChooser::setEnvironment(const Environment &env) -{ - setEnvironmentChange(EnvironmentChange::fromDictionary(env.toDictionary())); -} - FilePath PathChooser::baseDirectory() const { return d->m_baseDirectory; } -void PathChooser::setEnvironmentChange(const EnvironmentChange &env) +void PathChooser::setEnvironment(const Environment &env) { QString oldExpand = filePath().toString(); - d->m_environmentChange = env; + d->m_environment = env; if (filePath().toString() != oldExpand) { triggerChanged(); emit rawPathChanged(); @@ -619,8 +613,8 @@ bool PathChooser::validatePath(FancyLineEdit *edit, QString *errorMessage) const *errorMessage = Tr::tr("The path \"%1\" is not a directory.").arg(filePath.toUserOutput()); return false; } - if (HostOsInfo::isWindowsHost() && !filePath.startsWithDriveLetter() - && !filePath.startsWith("\\\\") && !filePath.startsWith("//")) { + if (filePath.osType() == OsTypeWindows && !filePath.startsWithDriveLetter() + && !filePath.startsWith("\\\\") && !filePath.startsWith("//")) { if (errorMessage) *errorMessage = Tr::tr("Invalid path \"%1\".").arg(filePath.toUserOutput()); return false; |