@@ -19,7 +19,6 @@ along with mvis-ethereum. If not, see <http://www.gnu.org/licenses/>.
19
19
#include < ethminer/ProgOpt.h>
20
20
#include < ethminer/ini_parser_ex.hpp>
21
21
#include < string>
22
- #include < boost/filesystem.hpp>
23
22
#include < boost/lexical_cast.hpp>
24
23
#include < ethminer/Misc.h>
25
24
#include < ethminer/MultiLog.h>
@@ -31,6 +30,7 @@ namespace fs = boost::filesystem;
31
30
pt::iptree *ProgOpt::m_tree;
32
31
bool ProgOpt::m_updating = false ;
33
32
ProgOpt::defaults_t *ProgOpt::m_defaults;
33
+ boost::filesystem::path ProgOpt::m_path;
34
34
35
35
36
36
bool ProgOpt::Load (std::string _config)
@@ -47,20 +47,19 @@ bool ProgOpt::Load(std::string _config)
47
47
return false ;
48
48
}
49
49
50
- fs::path path;
51
50
if (_config != " " )
52
- path = _config;
51
+ m_path = _config;
53
52
else
54
53
{
55
54
// try current folder first
56
- path = getExecFolder ();
57
- path = path / " tokenminer.ini" ;
58
- if (!fs::exists (path ))
55
+ m_path = getExecFolder ();
56
+ m_path = m_path / " tokenminer.ini" ;
57
+ if (!fs::exists (m_path ))
59
58
{
60
59
// check %LocalAppData
61
- path = getAppDataFolder ();
62
- path = path / " tokenminer.ini" ;
63
- if (!fs::exists (path ))
60
+ m_path = getAppDataFolder ();
61
+ m_path = m_path / " tokenminer.ini" ;
62
+ if (!fs::exists (m_path ))
64
63
{
65
64
LogB << " Error! Tokenminer.ini settings file not found." ;
66
65
return false ;
@@ -69,7 +68,7 @@ bool ProgOpt::Load(std::string _config)
69
68
}
70
69
try
71
70
{
72
- pt::read_ini_ex (path .generic_string (), *m_tree);
71
+ pt::read_ini_ex (m_path .generic_string (), *m_tree);
73
72
74
73
// set up sensible defaults for various settings. note that emplace does
75
74
// not overwrite existing values.
@@ -90,11 +89,14 @@ bool ProgOpt::Load(std::string _config)
90
89
return true ;
91
90
}
92
91
92
+ void ProgOpt::Reload ()
93
+ {
94
+ Load (m_path.generic_string ());
95
+ }
96
+
93
97
void ProgOpt::SaveToDisk ()
94
98
{
95
- fs::path path = getAppDataFolder ();
96
- path = path / " tokenminer.ini" ;
97
- pt::write_ini (path.string (), *m_tree);
99
+ pt::write_ini (m_path.string (), *m_tree);
98
100
}
99
101
100
102
std::string ProgOpt::Get (std::string _section, std::string _key, std::string _default)
0 commit comments