Nim: Use FilePath::searchInPath to find executable

Locally the same, potentially works remotely.

Change-Id: Ibdd6f545c089868549f86300d00116896c4f8f94
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-05-25 10:15:25 +02:00
parent 320064f431
commit 301017ab9c

View File

@@ -14,8 +14,6 @@
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QStandardPaths>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -180,10 +178,10 @@ FilePath nimPathFromKit(Kit *kit)
FilePath nimblePathFromKit(Kit *kit) FilePath nimblePathFromKit(Kit *kit)
{ {
// There's no extra setting for "nimble", derive it from the "nim" path. // There's no extra setting for "nimble", derive it from the "nim" path.
const QString nimbleFromPath = QStandardPaths::findExecutable("nimble"); const FilePath nimbleFromPath = FilePath("nimble").searchInPath();
const FilePath nimPath = nimPathFromKit(kit); const FilePath nimPath = nimPathFromKit(kit);
const FilePath nimbleFromKit = nimPath.pathAppended("nimble").withExecutableSuffix(); const FilePath nimbleFromKit = nimPath.pathAppended("nimble").withExecutableSuffix();
return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath() : FilePath::fromString(nimbleFromPath); return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath() : nimbleFromPath;
} }
bool NimBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const bool NimBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const