-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.d
44 lines (34 loc) · 878 Bytes
/
app.d
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
42
43
44
import std.stdio;
import std.getopt;
import desktopfile.utils;
int main(string[] args)
{
bool onlyExec;
bool notFollow;
getopt(
args,
"onlyExec", "Only start applications, don't open links", &onlyExec,
"notFollow", "Don't follow desktop files", ¬Follow);
string fileName;
if (args.length > 1) {
fileName = args[1];
} else {
stderr.writeln("Must provide path to desktop file");
return 1;
}
ShootOptions options;
if (onlyExec) {
options.flags = options.flags & ~ShootOptions.Link;
}
if (notFollow) {
options.flags = options.flags & ~ ShootOptions.FollowLink;
}
try {
shootDesktopFile(fileName, options);
}
catch(Exception e) {
stderr.writeln(e.msg);
return 1;
}
return 0;
}