]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkUtilities.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkUtilities.cxx
index ff96d767462d502ffe7aee9d2e9acc1f3700546a..0e57b2f904ef5ec7fac4170c096ab320580d01ed 100644 (file)
@@ -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)