-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.d
38 lines (33 loc) · 1.05 KB
/
test.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
/+dub.sdl:
name "test"
dependency "mimeapps" path="../"
+/
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);
}
}
}