]>
Dogcows Code - chaz/yoink/blob - src/moof/settings.cc
11dfe31b7d9b4478af16a457cb1e42863602e0c0
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 <stlplus/portability/file_system.hpp>
15 #include "settings.hh"
21 settings::settings(int argc
, char* argv
[], const std::string
& path
)
23 script_
.import_base_library();
26 parse_args(argc
, argv
);
36 void settings::parse_args(int argc
, char* argv
[])
38 for (int i
= 1; i
< argc
; ++i
)
40 if (script_
.do_string(argv
[i
]) != script::success
)
44 log_warning("invalid option", argv
[i
], "returned", str
);
45 script_
.clear_stack();
51 void settings::load_files(const std::string
& path
)
53 std::vector
<std::string
> paths
;
54 boost::split(paths
, path
, boost::is_any_of(":"));
59 void settings::load_files(const std::vector
<std::string
>& path
)
61 std::string home
= stlplus::folder_home();
63 std::vector
<std::string
>::iterator it
;
64 std::vector
<std::string
> copy(path
);
65 for (it
= copy
.begin(); it
!= copy
.end(); ++it
)
69 boost::replace_all(*it
, "$HOME", home
);
71 //logDebug("Copying global settings...");
73 //mGlobals.push_copy();
74 //script_.set("globals", script::registry_index);
77 if (script_
.do_file(*it
) != script::success
)
82 script_
.clear_stack();
88 void settings::clear()
94 void settings::save_as(const std::string
& path
)
100 void settings::save() const
102 // TODO saving settings not yet implemented
This page took 0.043918 seconds and 4 git commands to generate.