1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-06-30 21:02:21 +03:00

Use function getSkinPath() instead of reading the dir of the binary

... which was certain to fail as the skins are not located on
/usr/bin.
This commit is contained in:
Paul Cercueil 2012-06-24 23:18:02 +02:00
parent a21650d6b3
commit cf20f3673e
3 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ ImageDialog::ImageDialog(
string path; string path;
if (!file.empty()) { if (!file.empty()) {
path = strreplace(file, "skin:", gmenu2x->getExePath()+"skins/"+gmenu2x->confStr["skin"]+"/"); path = strreplace(file, "skin:", gmenu2x->sc.getSkinPath(gmenu2x->confStr["skin"]));
string::size_type pos = path.rfind("/"); string::size_type pos = path.rfind("/");
if (pos != string::npos) if (pos != string::npos)
setPath(path.substr(0, pos)); setPath(path.substr(0, pos));

View File

@ -84,7 +84,7 @@ const string &Link::getIcon() {
} }
void Link::setIcon(const string &icon) { void Link::setIcon(const string &icon) {
string skinpath = gmenu2x->getExePath()+"skins/"+gmenu2x->confStr["skin"]; string skinpath = gmenu2x->sc.getSkinPath(gmenu2x->confStr["skin"]);
if (icon.substr(0,skinpath.length()) == skinpath) { if (icon.substr(0,skinpath.length()) == skinpath) {
string tempIcon = icon.substr(skinpath.length(), icon.length()); string tempIcon = icon.substr(skinpath.length(), icon.length());
@ -99,7 +99,7 @@ void Link::setIcon(const string &icon) {
iconPath = strreplace(this->icon,"skin:",skinpath+"/"); iconPath = strreplace(this->icon,"skin:",skinpath+"/");
if (iconPath.empty() || !fileExists(iconPath)) { if (iconPath.empty() || !fileExists(iconPath)) {
iconPath = strreplace(this->icon,"skin:",gmenu2x->getExePath()+"skins/Default/"); iconPath = strreplace(this->icon,"skin:",gmenu2x->sc.getSkinPath("Default"));
if (!fileExists(iconPath)) searchIcon(); if (!fileExists(iconPath)) searchIcon();
} }

View File

@ -40,10 +40,10 @@ void MenuSettingImage::edit() {
} }
void MenuSettingImage::setValue(const string &value) { void MenuSettingImage::setValue(const string &value) {
string skinpath(gmenu2x->getExePath() + "skins/" + gmenu2x->confStr["skin"]); string skinpath(gmenu2x->sc.getSkinPath(gmenu2x->confStr["skin"]));
bool inSkinDir = value.substr(0, skinpath.length()) == skinpath; bool inSkinDir = value.substr(0, skinpath.length()) == skinpath;
if (!inSkinDir && gmenu2x->confStr["skin"] != "Default") { if (!inSkinDir && gmenu2x->confStr["skin"] != "Default") {
skinpath = gmenu2x->getExePath() + "skins/Default"; skinpath = gmenu2x->sc.getSkinPath("Default");
inSkinDir = value.substr(0, skinpath.length()) == skinpath; inSkinDir = value.substr(0, skinpath.length()) == skinpath;
} }
if (inSkinDir) { if (inSkinDir) {