mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 22:23:09 +02:00
Rewrote the function SurfaceCollection::getSkinFilePath() so that it'll search inside the right directories.
This commit is contained in:
parent
ead9706ffd
commit
d59b713e9b
@ -22,6 +22,7 @@
|
|||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "gmenu2x.h"
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -37,15 +38,25 @@ void SurfaceCollection::setSkin(const string &skin) {
|
|||||||
this->skin = skin;
|
this->skin = skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SurfaceCollection::getSkinFilePath(const string &file) {
|
string SurfaceCollection::getSkinFilePath(const string &file)
|
||||||
string prefix = "/usr/share/gmenu2x/";
|
{
|
||||||
if (fileExists("skins/"+skin+"/"+file))
|
/* We first search the skin file on the user-specific directory. */
|
||||||
return "skins/"+skin+"/"+file;
|
string path = GMenu2X::getHome() + "/skins/" + skin + "/" + file;
|
||||||
else if (fileExists("skins/Default/"+file))
|
if (fileExists(path))
|
||||||
return "skins/Default/"+file;
|
return path;
|
||||||
else if (fileExists(prefix+"skins/Default/"+file))
|
|
||||||
return prefix+"skins/Default/"+file;
|
/* If not found, we search that skin file on the system directory. */
|
||||||
else
|
path = GMENU2X_SYSTEM_DIR "/skins/" + skin + "/" + file;
|
||||||
|
if (fileExists(path))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
/* If it is nowhere to be found, as a last resort we check the
|
||||||
|
* "Default" skin on the system directory for a corresponding
|
||||||
|
* (but probably not similar) file. */
|
||||||
|
path = GMENU2X_SYSTEM_DIR "/skins/Default/" + file;
|
||||||
|
if (fileExists(path))
|
||||||
|
return path;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user