diff --git a/libpwrutils/pathsearch.cpp b/libpwrutils/pathsearch.cpp
index b53e26830d6da039ae8aa386ec3ae8c11bd8a795..973e518c4d545d5fb0b9ad7d90eb6ca6b440ffcf 100644
--- a/libpwrutils/pathsearch.cpp
+++ b/libpwrutils/pathsearch.cpp
@@ -121,7 +121,7 @@ std::vector<std::string> PathSearcherBase::list_files(const std::string& suffix)
 			for (directory_iterator i(p); i != directory_iterator(); ++i) {
 				boost::filesystem::path in = i->path();
 				if (in.extension() == suffix) {
-#if BOOST_FILESYSTEM_VERSION == 2
+#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2
 					out.push_back(in.stem());
 #else
 					out.push_back(in.stem().string());