X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSettings.cc;fp=src%2FMoof%2FSettings.cc;h=0000000000000000000000000000000000000000;hp=584643023892b89c2dec9bf373dcb160f9b3b2a1;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hpb=299af4f2047e767e5d79501c26444473bda64c64 diff --git a/src/Moof/Settings.cc b/src/Moof/Settings.cc deleted file mode 100644 index 5846430..0000000 --- a/src/Moof/Settings.cc +++ /dev/null @@ -1,107 +0,0 @@ - -/*] Copyright (c) 2009-2010, 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 // getenv - -#include "Settings.hh" - - -namespace Mf { - - -Settings::~Settings() -{ - save(); -} - - -void Settings::parseArgs(int argc, char* argv[]) -{ - for (int i = 1; i < argc; ++i) - { - if (mScript.doString(argv[i]) != Script::SUCCESS) - { - std::string str; - mScript[-1].get(str); - logWarning << "invalid option: " << argv[i] - << ": " << str << std::endl; - mScript.clearStack(); - } - } -} - - -void Settings::loadFromFiles(const std::string& path) -{ - std::vector paths; - boost::split(paths, path, boost::is_any_of(":")); - - loadFromFiles(paths); -} - -void Settings::loadFromFiles(const std::vector& path) -{ - std::vector copy(path); - std::vector::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 - - for (it = copy.begin(); it != copy.end(); ++it) - { - if (!home.empty()) - { - boost::replace_all(*it, "$HOME", home); - - //Mf::logDebug("Copying global settings..."); - //mUserFile = *it; - //mGlobals.pushCopy(); - //mScript.set("globals", Script::REGISTRY); - } - - if (mScript.doFile(*it) != Script::SUCCESS) - { - std::string str; - mScript[-1].get(str); - logWarning(str); - mScript.clearStack(); - } - } -} - - -void Settings::clear() -{ - mScript.reset(); -} - - -void Settings::saveAs(const std::string& path) -{ - mUserFile = path; - save(); -} - -void Settings::save() const -{ - // TODO saving settings not yet implemented -} - - -} // namepsace Mf -