1 #ifndef PSEUDO_SHARE_DIRECTORY_HPP 2 #define PSEUDO_SHARE_DIRECTORY_HPP 3 4 /* 5 Copyright (C) 2018 Xavier Andrade 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU Lesser General Public License as published by 9 the Free Software Foundation; either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #include <string> 23 24 namespace pseudopotential { 25 26 class share_directory { 27 28 public: 29 set(const std::string & dir)30 static void set(const std::string & dir){ 31 directory() = dir; 32 } 33 get()34 static std::string get(){ 35 if(directory().size() != 0) return directory(); 36 return SHARE_DIR; 37 } 38 39 40 private: 41 directory()42 static std::string & directory(){ 43 static std::string directory_; 44 return directory_; 45 } 46 47 }; 48 49 } 50 51 #endif 52 53 // Local Variables: 54 // mode: c++ 55 // coding: utf-8 56 // End: 57