diff options
Diffstat (limited to 'src/FbTk/LResource.cc')
-rw-r--r-- | src/FbTk/LResource.cc | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/FbTk/LResource.cc b/src/FbTk/LResource.cc index de90b95..18209cb 100644 --- a/src/FbTk/LResource.cc +++ b/src/FbTk/LResource.cc | |||
@@ -116,34 +116,12 @@ LResourceManager::LResourceManager(const std::string &root, Lua &l, unsigned int | |||
116 | setLua(l); | 116 | setLua(l); |
117 | } | 117 | } |
118 | 118 | ||
119 | void LResourceManager::load(const std::string &filename, const std::string &fallback) { | 119 | void LResourceManager::doLoad(const std::string &filename) { |
120 | _FB_USES_NLS; | ||
121 | m_l->checkstack(1); | 120 | m_l->checkstack(1); |
122 | lua::stack_sentry s(*m_l); | 121 | lua::stack_sentry s(*m_l); |
123 | 122 | ||
124 | m_filename = filename; | 123 | m_l->loadfile(filename.c_str()); |
125 | 124 | m_l->call(0, 0); | |
126 | try { | ||
127 | m_l->loadfile(filename.c_str()); | ||
128 | m_l->call(0, 0); | ||
129 | } | ||
130 | catch(lua::exception &e) { | ||
131 | std::cerr << _FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", | ||
132 | "Failed trying to read rc file") << ":" << filename << std::endl; | ||
133 | std::cerr << "Fluxbox: " << e.what() << std::endl; | ||
134 | std::cerr << _FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", | ||
135 | "Retrying rc file loading with (the following file)") | ||
136 | << ": " << fallback << std::endl; | ||
137 | try { | ||
138 | m_l->loadfile(fallback.c_str()); | ||
139 | m_l->call(0, 0); | ||
140 | } | ||
141 | catch(lua::exception &e) { | ||
142 | std::cerr << _FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "") | ||
143 | << ": " << fallback << std::endl; | ||
144 | std::cerr << "Fluxbox: " << e.what() << std::endl; | ||
145 | } | ||
146 | } | ||
147 | } | 125 | } |
148 | 126 | ||
149 | bool LResourceManager::save(const char *filename, const char *) { | 127 | bool LResourceManager::save(const char *filename, const char *) { |
@@ -153,8 +131,6 @@ bool LResourceManager::save(const char *filename, const char *) { | |||
153 | if(filename == NULL) | 131 | if(filename == NULL) |
154 | filename = m_filename.c_str(); | 132 | filename = m_filename.c_str(); |
155 | 133 | ||
156 | std::cerr << "XXX SAVING " << filename << std::endl; | ||
157 | |||
158 | m_l->getfield(lua::REGISTRYINDEX, dump_resources); | 134 | m_l->getfield(lua::REGISTRYINDEX, dump_resources); |
159 | m_l->getfield(lua::GLOBALSINDEX, m_root.c_str()); | 135 | m_l->getfield(lua::GLOBALSINDEX, m_root.c_str()); |
160 | m_l->pushstring(filename); | 136 | m_l->pushstring(filename); |