]>
Dogcows Code - chaz/yoink/blob - src/Moof/Settings.cc
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
12 #include <cstdlib> // getenv
14 #include "Settings.hh"
26 void Settings::parseArgs(int argc
, char* argv
[])
28 for (int i
= 1; i
< argc
; ++i
)
30 if (mScript
.doString(argv
[i
]) != Script::SUCCESS
)
34 logWarning
<< "invalid option: " << argv
[i
]
35 << ": " << str
<< std::endl
;
42 void Settings::loadFromFiles(const std::string
& path
)
44 std::vector
<std::string
> paths
;
45 boost::split(paths
, path
, boost::is_any_of(":"));
50 void Settings::loadFromFiles(const std::vector
<std::string
>& path
)
52 std::vector
<std::string
> copy(path
);
53 std::vector
<std::string
>::iterator it
;
56 char* homeDrive
= getenv("HOMEDRIVE");
57 char* homePath
= getenv("HOMEPATH");
58 std::string
home(homeDrive
? homeDrive
: "");
59 if (homePath
) home
+= homePath
;
61 char *homePath
= getenv("HOME");
62 std::string
home(homePath
? homePath
: "");
65 for (it
= copy
.begin(); it
!= copy
.end(); ++it
)
69 boost::replace_all(*it
, "$HOME", home
);
71 //Mf::logDebug("Copying global settings...");
73 //mGlobals.pushCopy();
74 //mScript.set("globals", Script::REGISTRY);
77 if (mScript
.doFile(*it
) != Script::SUCCESS
)
88 void Settings::clear()
94 void Settings::saveAs(const std::string
& path
)
100 void Settings::save() const
102 // TODO saving settings not yet implemented
This page took 0.042134 seconds and 4 git commands to generate.