X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=kernel%2Fsrc%2FbbtkUtilities.cxx;fp=kernel%2Fsrc%2FbbtkUtilities.cxx;h=0e57b2f904ef5ec7fac4170c096ab320580d01ed;hb=9ebbefccfab8978b357669af56a08d661386df9a;hp=ff96d767462d502ffe7aee9d2e9acc1f3700546a;hpb=af5fbba42a9b663e2ce1e5fbbe71e904e570a089;p=bbtk.git diff --git a/kernel/src/bbtkUtilities.cxx b/kernel/src/bbtkUtilities.cxx index ff96d76..0e57b2f 100644 --- a/kernel/src/bbtkUtilities.cxx +++ b/kernel/src/bbtkUtilities.cxx @@ -1,5 +1,6 @@ #include "bbtkUtilities.h" + namespace bbtk { @@ -264,6 +265,25 @@ namespace bbtk return libname; } + // ======================================================================= + /// Builds the complete path to the file 'name' located + /// in user settings dir, e.g. /home/username/.bbtk/ + std::string Utilities::MakeUserSettingsFullFileName(const std::string& name) + { +#if defined(__GNUC__) + std::string str_home(getenv("HOME")); +#elif defined(_WIN32) + std::string str_home(getenv("USERPROFILE")); +#endif + std::string fullname = str_home + "/.bbtk/" + name; + Utilities::replace( fullname, + INVALID_FILE_SEPARATOR , + VALID_FILE_SEPARATOR); + return fullname; + } + + + //======================================================================== bool Utilities::IsAtRoot(std::string cwd)