moving some non-portable code to stlplus
[chaz/yoink] / src / moof / settings.cc
index 4e026929dd779c8dfbffaa0dfa98b26f15f6a928..11dfe31b7d9b4478af16a457cb1e42863602e0c0 100644 (file)
@@ -9,7 +9,7 @@
 *
 **************************************************************************/
 
-#include <cstdlib>             // getenv
+#include <stlplus/portability/file_system.hpp>
 
 #include "log.hh"
 #include "settings.hh"
@@ -41,8 +41,7 @@ void settings::parse_args(int argc, char* argv[])
                {
                        std::string str;
                        script_[-1].get(str);
-                       log_warning << "invalid option: " << argv[i]
-                                          << ": " << str << std::endl;
+                       log_warning("invalid option", argv[i], "returned", str);
                        script_.clear_stack();
                }
        }
@@ -59,19 +58,10 @@ void settings::load_files(const std::string& path)
 
 void settings::load_files(const std::vector<std::string>& path)
 {
-       std::vector<std::string> copy(path);
-       std::vector<std::string>::iterator it;
-
-#if defined(_WIN32)
-       char* homeDrive = getenv("HOMEDRIVE");
-       char* homePath = getenv("HOMEPATH");
-       std::string home(homeDrive ? homeDrive : "");
-       if (homePath) home += homePath;
-#else
-       char *homePath = getenv("HOME");
-       std::string home(homePath ? homePath : "");
-#endif
+       std::string home = stlplus::folder_home();
 
+       std::vector<std::string>::iterator it;
+       std::vector<std::string> copy(path);
        for (it = copy.begin(); it != copy.end(); ++it)
        {
                if (!home.empty())
This page took 0.017525 seconds and 4 git commands to generate.