X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=blobdiff_plain;f=src%2Fpaths.cpp;h=1cebcc8f603aca440cc0428f553e15790e698406;hp=ae05f3b661d400ac988201c429b4ee1c2889c885;hb=9d35c3ae2a2571bb3fb47d359f70ac43f0f2427d;hpb=a4865ebd5fe341be517b9bc8589ed0f818fa9d5f diff --git a/src/paths.cpp b/src/paths.cpp index ae05f3b..1cebcc8 100644 --- a/src/paths.cpp +++ b/src/paths.cpp @@ -1,3 +1,20 @@ +/* Dungeon Master --- Adventure generator for GNU Guile + Copyright © 2019 Javier Sancho + + Dungeon Master is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Dungeon Master is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Haunt. If not, see . +*/ + #include #include "paths.h" @@ -15,14 +32,18 @@ std::string get_exec_path() pBuf[bytes] = '\0'; std::string exec_path = pBuf; - return exec_path.substr(0, exec_path.rfind(DIR_DELIM) + 1); + return exec_path.substr(0, exec_path.rfind(PATH_DELIM) + 1); } +std::string get_home_path() +{ + return (std::string)getenv("HOME") + PATH_DELIM + "." + PROGRAM_NAME; +} -std::set get_dm_paths() { +std::set get_data_paths() { std::set paths; - paths.insert(get_exec_path()); - + paths.insert(DATA_PATH); + paths.insert(get_home_path()); return paths; }