diff options
Diffstat (limited to 'depends/util/src/pathutils.cpp')
-rw-r--r-- | depends/util/src/pathutils.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/depends/util/src/pathutils.cpp b/depends/util/src/pathutils.cpp index 35c7f901..af1843ba 100644 --- a/depends/util/src/pathutils.cpp +++ b/depends/util/src/pathutils.cpp @@ -40,6 +40,24 @@ QString AbsolutePath(QString path) return QFileInfo(path).absolutePath(); } +QString ResolveExecutable(QString path) +{ + if (path.isEmpty()) + { + return QString(); + } + if(!path.contains('/')) + { + path = QStandardPaths::findExecutable(path); + } + QFileInfo pathInfo(path); + if(!pathInfo.exists() || !pathInfo.isExecutable()) + { + return QString(); + } + return pathInfo.absoluteFilePath(); +} + /** * Normalize path * |