Commit e835f0b4 authored by Aleksy Barcz's avatar Aleksy Barcz
Browse files

better searching for SZARP configurations

+ stem() would transform /opt/szarp/szarp/foo.bar to foo, which would lead to a segfault e.g. in ekstraktor3 if we had both foo and foo.bak directories (configuration foo would be read twice, leading to some memory issues)
+ filename() is the way to go with boost::filesystem::path, it returns the last component of a path (stem() is based on filename() btw)
parent ddc92d09
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ const std::vector<std::string> IPKContainer::GetAvailablePrefixes() {
	boost::filesystem::path szarp_path(m_szarp_data_dir);
	if (is_directory(szarp_path)){
		for (boost::filesystem::directory_iterator itr(szarp_path); itr != end_itr; ++itr){
			std::string prefix(itr->path().stem().c_str());
			std::string prefix(itr->path().filename().c_str());
			if (boost::filesystem::exists(std::string(m_szarp_data_dir).append(prefix).append("/config/params.xml").c_str())) {
				prefixes.push_back(std::string(prefix));
			}