Skip to content

Commit

Permalink
Add coveralls badge. Update desktoptest example
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Oct 1, 2015
1 parent b0a807e commit 7a78a98
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ matrix:

script:
- dub test --compiler=${DC}
- dub build desktopfile:desktoptest --compiler=${DC}
- dub build desktopfile:desktoputil --compiler=${DC}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

D library for working with *.desktop* files. Desktop entries in Freedesktop world are akin to shortcuts from Windows world (.lnk files).

[![Build Status](https://travis-ci.org/MyLittleRobo/desktopfile.svg?branch=master)](https://travis-ci.org/MyLittleRobo/desktopfile)
[![Build Status](https://travis-ci.org/MyLittleRobo/desktopfile.svg?branch=master)](https://travis-ci.org/MyLittleRobo/desktopfile) [![Coverage Status](https://coveralls.io/repos/MyLittleRobo/desktopfile/badge.svg?branch=master&service=github)](https://coveralls.io/github/MyLittleRobo/desktopfile?branch=master)

The most of desktop environments on Linux and BSD flavors follows [Desktop Entry Specification](http://standards.freedesktop.org/desktop-entry-spec/latest/) today.
The goal of **desktopfile** library is to provide implementation of this specification in D programming language.
Expand Down Expand Up @@ -75,3 +75,11 @@ Use this example to check if the desktopfile library can parse all .desktop file
To print all directories examined by desktoptest to stdout, build it in non-release mode:

dub run desktopfile:desktoptest

Start desktoptest on specified directories:

dub run desktopfile:desktoptest -- /path/to/applications /anotherpath/to/applications
# Example using cmd on Windows:
dub run desktopfile:desktoptest -- "%SYSTEMDRIVE%\ProgramData\KDE\share\applications" "%APPDATA%\.kde\share"


39 changes: 32 additions & 7 deletions examples/desktoptest/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,42 @@ import std.file;
import std.path;
import std.process;

import standardpaths;
import desktopfile;

string[] desktopDirs()
{
return applicationsPaths() ~ writablePath(StandardPath.Desktop);
}

void main(string[] args)
{
foreach(dir; desktopDirs().filter!(s => s.exists && s.isDir())) {
string[] desktopDirs;

version(OSX) {} else version(Posix) {
import standardpaths;

desktopDirs = applicationsPaths() ~ writablePath(StandardPath.Desktop);
} else version(Windows) {
try {
auto root = environment.get("SYSTEMDRIVE", "C:");
auto kdeDir = root ~ `\ProgramData\KDE\share\applications`;
writeln(kdeDir);
if (kdeDir.isDir) {
desktopDirs = [kdeDir];
}
} catch(Exception e) {

}
}

if (args.length > 1) {
desktopDirs = args[1..$];
}

if (!desktopDirs.length) {
writeln("No desktop directories given nor could be detected");
writefln("Usage: %s [DIR]...", args[0]);
return;
}

writefln("Using directories: %-(%s, %)", desktopDirs);

foreach(dir; desktopDirs.filter!(s => s.exists && s.isDir())) {
foreach(entry; dir.dirEntries(SpanMode.depth).filter!(a => a.isFile() && a.extension == ".desktop")) {
debug writeln(entry);
try {
Expand Down

0 comments on commit 7a78a98

Please sign in to comment.