forked from qt-creator/qt-creator
ScreenRecorder: Add additional search paths
Adds a function FileUtils::usefullExtraSearchPaths() that returns OS specific paths that often are not in PATH by default, but contain useful apps we want to find. Change-Id: Ideb7c45b241c69c9f2db8f75726bb63249000a5f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "algorithm.h"
|
#include "algorithm.h"
|
||||||
#include "devicefileaccess.h"
|
#include "devicefileaccess.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "qtcassert.h"
|
#include "qtcassert.h"
|
||||||
#include "utilstr.h"
|
#include "utilstr.h"
|
||||||
|
|
||||||
@@ -843,4 +844,18 @@ qint64 FileUtils::bytesAvailableFromDFOutput(const QByteArray &dfOutput)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePaths FileUtils::usefulExtraSearchPaths()
|
||||||
|
{
|
||||||
|
if (HostOsInfo::isMacHost()) {
|
||||||
|
return {"/opt/homebrew/bin"};
|
||||||
|
} else if (HostOsInfo::isWindowsHost()) {
|
||||||
|
const QString programData =
|
||||||
|
qtcEnvironmentVariable("ProgramData",
|
||||||
|
qtcEnvironmentVariable("ALLUSERSPROFILE", "C:/ProgramData"));
|
||||||
|
return {FilePath::fromUserInput(programData) / "chocolatey/bin"};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ public:
|
|||||||
|
|
||||||
static FilePathInfo filePathInfoFromTriple(const QString &infos, int modeBase);
|
static FilePathInfo filePathInfoFromTriple(const QString &infos, int modeBase);
|
||||||
|
|
||||||
|
//! Returns known paths like /opt/homebrew on macOS that might not be in PATH
|
||||||
|
static FilePaths usefulExtraSearchPaths();
|
||||||
|
|
||||||
#ifdef QT_WIDGETS_LIB
|
#ifdef QT_WIDGETS_LIB
|
||||||
static void setDialogParentGetter(const std::function<QWidget *()> &getter);
|
static void setDialogParentGetter(const std::function<QWidget *()> &getter);
|
||||||
|
|
||||||
|
|||||||
@@ -54,16 +54,18 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
|||||||
ffmpegTool.setSettingsKey("FFmpegTool");
|
ffmpegTool.setSettingsKey("FFmpegTool");
|
||||||
ffmpegTool.setExpectedKind(PathChooser::ExistingCommand);
|
ffmpegTool.setExpectedKind(PathChooser::ExistingCommand);
|
||||||
ffmpegTool.setCommandVersionArguments(versionArgs);
|
ffmpegTool.setCommandVersionArguments(versionArgs);
|
||||||
const FilePath ffmpegDefault =
|
const FilePath ffmpegDefault
|
||||||
Environment::systemEnvironment().searchInPath(Constants::FFMPEG_COMMAND);
|
= Environment::systemEnvironment().searchInPath(Constants::FFMPEG_COMMAND,
|
||||||
|
FileUtils::usefulExtraSearchPaths());
|
||||||
ffmpegTool.setDefaultValue(ffmpegDefault.toUserOutput());
|
ffmpegTool.setDefaultValue(ffmpegDefault.toUserOutput());
|
||||||
ffmpegTool.setLabelText(Tr::tr("ffmpeg tool:"));
|
ffmpegTool.setLabelText(Tr::tr("ffmpeg tool:"));
|
||||||
|
|
||||||
ffprobeTool.setSettingsKey("FFprobeTool");
|
ffprobeTool.setSettingsKey("FFprobeTool");
|
||||||
ffprobeTool.setExpectedKind(PathChooser::ExistingCommand);
|
ffprobeTool.setExpectedKind(PathChooser::ExistingCommand);
|
||||||
ffprobeTool.setCommandVersionArguments(versionArgs);
|
ffprobeTool.setCommandVersionArguments(versionArgs);
|
||||||
const FilePath ffprobeDefault =
|
const FilePath ffprobeDefault
|
||||||
Environment::systemEnvironment().searchInPath(Constants::FFPROBE_COMMAND);
|
= Environment::systemEnvironment().searchInPath(Constants::FFPROBE_COMMAND,
|
||||||
|
FileUtils::usefulExtraSearchPaths());
|
||||||
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
||||||
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user