diff options
Diffstat (limited to 'server/src/macrolist.cc')
-rw-r--r-- | server/src/macrolist.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/src/macrolist.cc b/server/src/macrolist.cc index b67f239..0d0916d 100644 --- a/server/src/macrolist.cc +++ b/server/src/macrolist.cc @@ -58,6 +58,8 @@ static std::vector<std::string> listdir(std::string path) MacroList::MacroList(std::string macropath) { + MutexAutolock lock(mutex); + this->macropath = macropath; std::vector<std::string> macros = listdir(macropath); std::vector<std::string>::iterator i = macros.begin(); @@ -91,6 +93,8 @@ MacroList::MacroList(std::string macropath) std::string MacroList::getLatestVersion(std::string macro) throw(Exception) { + MutexAutolock lock(mutex); + if(find(macro) == end()) throw Exception("Macro ["+macro+"] does not exist"); MacroListItem mli = (*this)[macro]; if(mli.size() == 0) return ""; @@ -98,6 +102,7 @@ std::string MacroList::getLatestVersion(std::string macro) throw(Exception) macro.c_str(), (macropath + "/" + mli.begin()->second).c_str(), ((std::string)mli.begin()->first).c_str()); + return macropath + "/" + mli.begin()->second; } |