]>
Dogcows Code - chaz/yoink/blob - src/moof/settings.cc
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
10 #include <stlplus/portability/file_system.hpp>
13 #include "settings.hh"
19 settings::settings(int argc
, char* argv
[], const std::string
& path
)
21 script_
.import_base_library();
24 parse_args(argc
, argv
);
33 void settings::parse_args(int argc
, char* argv
[])
35 for (int i
= 1; i
< argc
; ++i
)
37 if (script_
.do_string(argv
[i
]) != script::success
)
41 log_warning("invalid option", argv
[i
], "returned", str
);
42 script_
.clear_stack();
47 void settings::load_files(const std::string
& path
)
49 std::vector
<std::string
> paths
;
50 boost::split(paths
, path
, boost::is_any_of(":"));
54 void settings::load_files(const std::vector
<std::string
>& path
)
56 std::string home
= stlplus::folder_home();
58 std::vector
<std::string
>::iterator it
;
59 std::vector
<std::string
> copy(path
);
60 for (it
= copy
.begin(); it
!= copy
.end(); ++it
)
64 boost::replace_all(*it
, "$HOME", home
);
66 //logDebug("Copying global settings...");
68 //mGlobals.push_copy();
69 //script_.set("globals", script::registry_index);
71 if (script_
.do_file(*it
) != script::success
)
76 script_
.clear_stack();
81 void settings::clear()
86 void settings::save_as(const std::string
& path
)
92 void settings::save() const
94 // TODO saving settings not yet implemented
This page took 0.037533 seconds and 4 git commands to generate.