From 3db5844f3c62425a37dd83e2c27eb6b809c19dfb Mon Sep 17 00:00:00 2001 From: Ayla Date: Tue, 29 Mar 2011 21:22:32 +0200 Subject: [PATCH] The function SurfaceCollection::getSkinPath() will return the path of a skin directory from its name given as a parameter. --- src/surfacecollection.cpp | 15 +++++++++++++++ src/surfacecollection.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/surfacecollection.cpp b/src/surfacecollection.cpp index b6d4fc4..75e33ee 100644 --- a/src/surfacecollection.cpp +++ b/src/surfacecollection.cpp @@ -38,6 +38,21 @@ void SurfaceCollection::setSkin(const string &skin) { this->skin = skin; } +/* Returns the location of a skin directory, + * from its name given as a parameter. */ +string SurfaceCollection::getSkinPath(const string &skin) +{ + string path = GMenu2X::getHome() + "/skins/" + skin; + if (fileExists(path)) + return path; + + path = GMENU2X_SYSTEM_DIR "/skins/" + skin; + if (fileExists(path)) + return path; + + return ""; +} + string SurfaceCollection::getSkinFilePath(const string &file) { return SurfaceCollection::getSkinFilePath(skin, file); diff --git a/src/surfacecollection.h b/src/surfacecollection.h index 9a8874f..f0a2b48 100644 --- a/src/surfacecollection.h +++ b/src/surfacecollection.h @@ -45,6 +45,7 @@ public: void setSkin(const std::string &skin); std::string getSkinFilePath(const std::string &file); static std::string getSkinFilePath(const std::string &skin, const std::string &file); + static std::string getSkinPath(const std::string &skin); bool defaultAlpha; void debug();