mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 20:21:52 +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 "utilities.h"
|
||||
#include "debug.h"
|
||||
#include "gmenu2x.h"
|
||||
|
||||
using std::endl;
|
||||
using std::string;
|
||||
@ -37,15 +38,25 @@ void SurfaceCollection::setSkin(const string &skin) {
|
||||
this->skin = skin;
|
||||
}
|
||||
|
||||
string SurfaceCollection::getSkinFilePath(const string &file) {
|
||||
string prefix = "/usr/share/gmenu2x/";
|
||||
if (fileExists("skins/"+skin+"/"+file))
|
||||
return "skins/"+skin+"/"+file;
|
||||
else if (fileExists("skins/Default/"+file))
|
||||
return "skins/Default/"+file;
|
||||
else if (fileExists(prefix+"skins/Default/"+file))
|
||||
return prefix+"skins/Default/"+file;
|
||||
else
|
||||
string SurfaceCollection::getSkinFilePath(const string &file)
|
||||
{
|
||||
/* We first search the skin file on the user-specific directory. */
|
||||
string path = GMenu2X::getHome() + "/skins/" + skin + "/" + file;
|
||||
if (fileExists(path))
|
||||
return path;
|
||||
|
||||
/* If not found, we search that skin file on the system directory. */
|
||||
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 "";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user