| 1 | /* |
| 2 | * File: Environment.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Aug 8, 2009 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * |
| 11 | * This program is free software: you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation, either version 3 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include "Environment.h" |
| 27 | |
| 28 | #include "cstdlib" |
| 29 | |
| 30 | #define ENV_ICONS "HERCULES_ICONS" |
| 31 | |
| 32 | std::string Environment::mEmptyString; |
| 33 | std::string Environment::mDefaultIconPath = ":/icons";//"/usr/share/herculesstudio/icons"; |
| 34 | std::string *Environment::mIconsPath = NULL; |
| 35 | |
| 36 | Environment::Environment() |
| 37 | { |
| 38 | |
| 39 | |
| 40 | } |
| 41 | |
| 42 | Environment::~Environment() |
| 43 | { |
| 44 | delete mIconsPath; |
| 45 | } |
| 46 | |
| 47 | std::string& Environment::getIconsPath() |
| 48 | { |
| 49 | if (mIconsPath != NULL) return *mIconsPath; |
| 50 | char * path = getenv("HERCULES_ICONS"); |
| 51 | if (path == NULL) mIconsPath = &mDefaultIconPath; |
| 52 | else mIconsPath = new std::string(path); |
| 53 | return *mIconsPath; |
| 54 | } |