DeviceSupport: Add more error output

Previously most errors when opening shells were completely
opaque to the user. This patch adds error output either via
QMessageBox if there is another modal dialog, or as flashing
disrupting messages.

Change-Id: I54be7a90295b61c23c739294c2d1d37c288ad273
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-10-06 08:51:17 +02:00
parent 113efbfc85
commit 1fabd72514
17 changed files with 185 additions and 104 deletions

View File

@@ -508,13 +508,16 @@ std::optional<FilePath> FilePath::refersToExecutableFile(MatchScope matchScope)
expected_str<FilePath> FilePath::tmpDir() const
{
if (needsDevice()) {
const Environment env = deviceEnvironment();
if (env.hasKey("TMPDIR"))
return withNewPath(env.value("TMPDIR")).cleanPath();
if (env.hasKey("TEMP"))
return withNewPath(env.value("TEMP")).cleanPath();
if (env.hasKey("TMP"))
return withNewPath(env.value("TMP")).cleanPath();
const expected_str<Environment> env = deviceEnvironmentWithError();
if (!env)
return make_unexpected(env.error());
if (env->hasKey("TMPDIR"))
return withNewPath(env->value("TMPDIR")).cleanPath();
if (env->hasKey("TEMP"))
return withNewPath(env->value("TEMP")).cleanPath();
if (env->hasKey("TMP"))
return withNewPath(env->value("TMP")).cleanPath();
if (osType() != OsTypeWindows)
return withNewPath("/tmp");
@@ -1707,6 +1710,13 @@ FilePaths FilePath::searchAllInPath(const FilePaths &additionalDirs,
}
Environment FilePath::deviceEnvironment() const
{
expected_str<Environment> env = deviceEnvironmentWithError();
QTC_ASSERT_EXPECTED(env, return {});
return *env;
}
expected_str<Environment> FilePath::deviceEnvironmentWithError() const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.environment, return {});