Add DEBUG_TRACE output to file utility functions in libpbd

This commit is contained in:
Paul Davis 2013-07-13 16:55:40 -04:00
parent 550eeecc63
commit ccdc6fcd6a
3 changed files with 21 additions and 9 deletions

View file

@ -49,6 +49,7 @@ uint64_t PBD::DEBUG::FileManager = PBD::new_debug_bit ("filemanager");
uint64_t PBD::DEBUG::Pool = PBD::new_debug_bit ("pool"); uint64_t PBD::DEBUG::Pool = PBD::new_debug_bit ("pool");
uint64_t PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop"); uint64_t PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop");
uint64_t PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui"); uint64_t PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui");
uint64_t PBD::DEBUG::FileUtils = PBD::new_debug_bit ("fileutils");
uint64_t PBD::debug_bits = 0x0; uint64_t PBD::debug_bits = 0x0;

View file

@ -35,6 +35,7 @@
#include "pbd/compose.h" #include "pbd/compose.h"
#include "pbd/file_utils.h" #include "pbd/file_utils.h"
#include "pbd/debug.h"
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/pathscanner.h" #include "pbd/pathscanner.h"
#include "pbd/stl_delete.h" #include "pbd/stl_delete.h"
@ -80,6 +81,11 @@ find_matching_files_in_directory (const std::string& directory,
std::string full_path(directory); std::string full_path(directory);
full_path = Glib::build_filename (full_path, *file_iter); full_path = Glib::build_filename (full_path, *file_iter);
DEBUG_TRACE (
DEBUG::FileUtils,
string_compose("Found file %1\n", full_path)
);
result.push_back(full_path); result.push_back(full_path);
} }
} }
@ -117,24 +123,28 @@ find_file_in_search_path(const SearchPath& search_path,
if (tmp.size() == 0) if (tmp.size() == 0)
{ {
DEBUG_TRACE (
DEBUG::FileUtils,
string_compose("No file matching %1 found in Path: %2\n", filename, search_path.to_string())
);
return false; return false;
} }
#if 0
if (tmp.size() != 1) if (tmp.size() != 1)
{ {
info << string_compose DEBUG_TRACE (
( DEBUG::FileUtils,
"Found more than one file matching %1 in search path %2", string_compose("Found more that one file matching %1 in Path: %2\n", filename, search_path.to_string())
filename, );
search_path ()
)
<< endmsg;
} }
#endif
result = tmp.front(); result = tmp.front();
DEBUG_TRACE (
DEBUG::FileUtils,
string_compose("Found file %1 in Path: %2\n", filename, search_path.to_string())
);
return true; return true;
} }

View file

@ -43,6 +43,7 @@ namespace PBD {
extern uint64_t Pool; extern uint64_t Pool;
extern uint64_t EventLoop; extern uint64_t EventLoop;
extern uint64_t AbstractUI; extern uint64_t AbstractUI;
extern uint64_t FileUtils;
} }
} }