]>
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 mScript
.doString(argv
[i
]);
35 void Settings::loadFromFiles(const std::string
& path
)
37 std::vector
<std::string
> paths
;
38 boost::split(paths
, path
, boost::is_any_of(":"));
43 void Settings::loadFromFiles(const std::vector
<std::string
>& path
)
45 std::vector
<std::string
> copy(path
);
46 std::vector
<std::string
>::iterator it
;
48 #if defined(_WIN32) || defined(__WIN32__)
49 char* homeDrive
= getenv("HOMEDRIVE");
50 char* homePath
= getenv("HOMEPATH");
51 std::string
home(homeDrive
? homeDrive
: "");
52 if (homePath
) home
+= homePath
;
54 char *homePath
= getenv("HOME");
55 std::string
home(homePath
? homePath
: "");
58 for (it
= copy
.begin(); it
!= copy
.end(); ++it
)
62 boost::replace_all(*it
, "$HOME", home
);
64 //Mf::logDebug("Copying global settings...");
66 //mGlobals.pushCopy();
67 //mScript.set("globals", Script::REGISTRY);
70 if (mScript
.doFile(*it
) != Script::SUCCESS
)
81 void Settings::clear()
87 void Settings::saveAs(const std::string
& path
)
93 void Settings::save() const
95 // TODO saving settings not yet implemented
99 Settings settings
; // global instance
This page took 0.039376 seconds and 4 git commands to generate.