Skip to content

Commit

Permalink
Update dependency on inilike
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Sep 18, 2020
1 parent d0bbfc4 commit 9f286ef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"copyright": "Copyright © 2015-2016, Roman Chistokhodov",
"authors": ["Roman Chistokhodov"],
"dependencies": {
"inilike": "~>1.1.0",
"inilike": "~>1.2.0",
"xdgpaths" : "~>0.2.4",
"findexecutable" : "~>0.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import isfreedesktop;
@safe string currentLocale() nothrow
{
try {
return environment.get("LC_CTYPE", environment.get("LC_ALL", environment.get("LANG")));
return environment.get("LC_ALL", environment.get("LC_MESSAGES", environment.get("LANG")));
}
catch(Exception e) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion source/desktopfile/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ Name=Two`;

df = new DesktopFile(iniLikeStringReader(contents), DesktopReadOptions(DuplicateGroupPolicy.preserve));
assert(df.displayName() == "One");
assert(df.byGroup().map!(g => g["Name"]).equal(["One", "Two"]));
assert(df.byGroup().map!(g => g.escapedValue("Name")).equal(["One", "Two"]));
}

protected:
Expand Down
12 changes: 4 additions & 8 deletions source/desktopfile/utils.d
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@ package bool readDesktopEntryValues(IniLikeReader)(IniLikeReader reader, string
import inilike.read;
string bestLocale;
bool hasDesktopEntry;
auto onMyLeadingComment = delegate void(string line) {

};
auto onMyGroup = delegate ActionOnGroup(string groupName) {
if (groupName == "Desktop Entry") {
hasDesktopEntry = true;
Expand All @@ -866,19 +863,16 @@ package bool readDesktopEntryValues(IniLikeReader)(IniLikeReader reader, string
default: {
auto kl = separateFromLocale(key);
if (kl[0] == "Name") {
auto lv = chooseLocalizedValue(locale, kl[1], value, bestLocale, name);
auto lv = selectLocalizedValue(locale, kl[1], value, bestLocale, name);
bestLocale = lv[0];
name = lv[1].unescapeValue();
}
}
break;
}
};
auto onMyCommentInGroup = delegate void(string line, string groupName) {

};

readIniLike(reader, onMyLeadingComment, onMyGroup, onMyKeyValue, onMyCommentInGroup, fileName);
readIniLike(reader, null, onMyGroup, onMyKeyValue, null, fileName);
return hasDesktopEntry;
}

Expand All @@ -896,6 +890,8 @@ unittest
assert(workingDirectory == "/usr/bin");
assert(terminal);
assert(name == "Пример");
readDesktopEntryValues(reader, string.init, null, iconName, name , execValue, url, workingDirectory, terminal);
assert(name == "Example");
}

/**
Expand Down

0 comments on commit 9f286ef

Please sign in to comment.