]> Dogcows Code - chaz/yoink/blobdiff - src/moof/settings.cc
remove some unused stlplus modules
[chaz/yoink] / src / moof / settings.cc
index 4e026929dd779c8dfbffaa0dfa98b26f15f6a928..78f72939d2a58faa9aada73ae7014232e7f5a9a9 100644 (file)
@@ -1,15 +1,13 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
-#include <cstdlib>             // getenv
+#include <stlplus/portability/file_system.hpp>
 
 #include "log.hh"
 #include "settings.hh"
@@ -32,7 +30,6 @@ settings::~settings()
        save();
 }
 
-
 void settings::parse_args(int argc, char* argv[])
 {
        for (int i = 1; i < argc; ++i)
@@ -41,37 +38,25 @@ 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();
                }
        }
 }
 
-
 void settings::load_files(const std::string& path)
 {
        std::vector<std::string> paths;
        boost::split(paths, path, boost::is_any_of(":"));
-
        load_files(paths);
 }
 
 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())
@@ -79,11 +64,10 @@ void settings::load_files(const std::vector<std::string>& path)
                        boost::replace_all(*it, "$HOME", home);
 
                        //logDebug("Copying global settings...");
-                       //mUserFile = *it;
+                       //userfile_ = *it;
                        //mGlobals.push_copy();
                        //script_.set("globals", script::registry_index);
                }
-
                if (script_.do_file(*it) != script::success)
                {
                        std::string str;
@@ -94,16 +78,14 @@ void settings::load_files(const std::vector<std::string>& path)
        }
 }
 
-
 void settings::clear()
 {
        script_.reset();
 }
 
-
 void settings::save_as(const std::string& path)
 {
-       mUserFile = path;
+       userfile_ = path;
        save();
 }
 
This page took 0.020045 seconds and 4 git commands to generate.