/
app.d
33 lines (29 loc) · 1.01 KB
/
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
import std.stdio;
import std.algorithm;
import std.file;
import mimeapps;
void main()
{
auto mimeListPaths = mimeAppsListPaths();
auto mimeCachePaths = mimeInfoCachePaths();
writeln("Using mimeapps.list files: ", mimeListPaths);
writeln("Using mimeinfo.cache files: ", mimeCachePaths);
foreach(path; mimeListPaths.filter!(p => p.exists)) {
try {
new MimeAppsListFile(path);
} catch(IniLikeReadException e) {
stderr.writefln("Error reading %s: at %s: %s", path, e.lineNumber, e.msg);
} catch(Exception e) {
stderr.writefln("Error reading %s: %s", path, e.msg);
}
}
foreach(path; mimeCachePaths.filter!(p => p.exists)) {
try {
new MimeInfoCacheFile(path);
} catch(IniLikeReadException e) {
stderr.writefln("Error reading %s: at %s: %s", path, e.lineNumber, e.msg);
} catch(Exception e) {
stderr.writefln("Error reading %s: %s", path, e.msg);
}
}
}