-
Notifications
You must be signed in to change notification settings - Fork 10
/
lima.cpp
41 lines (33 loc) · 896 Bytes
/
lima.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <QString>
#include <QStandardPaths>
#include <QFileInfo>
#include "lima.h"
QString defaultYAML()
{
return "templates/default.yaml";
}
QString defaultURL()
{
return "https://github.com/lima-vm/lima/blob/master/templates/default.yaml";
}
QStringList brewPaths()
{
return QStringList({ "/usr/local/bin", "/opt/homebrew/bin", "/home/linuxbrew/.linuxbrew/bin",
"/opt/local/bin" });
}
static QStringList standardPaths;
QString limactlPath(const QStringList &paths)
{
QStringList searchPaths;
if (paths.isEmpty()) {
searchPaths = standardPaths;
} else {
standardPaths = paths;
searchPaths = paths;
}
QString program = QStandardPaths::findExecutable("limactl", searchPaths);
if (program.isEmpty()) {
program = QStandardPaths::findExecutable("limactl", brewPaths());
}
return program;
}