Tim Mayberry
28ac321d31
Add unit tests for PBD::clear_directory and PBD::remove_directory
2014-08-17 18:44:06 -04:00
Tim Mayberry
1e1a291ee2
Rename internal class to stop the wrong destructor from being called
2014-08-17 18:44:01 -04:00
Tim Mayberry
5d6809d346
Add a PBD::TextReceiver in pbd testrunner
2014-08-17 18:43:43 -04:00
Tim Mayberry
9c16e67b06
Add simple test for PBD::find_files_matching_pattern
...
This helped fix a silly cut and paste error in pbd/file_utils.cc so
might as well included it.
2014-08-17 18:43:37 -04:00
Tim Mayberry
b3ab6e79f1
Use PBD::FdFileDescriptor in PBD::copy_file
2014-08-17 18:43:31 -04:00
Tim Mayberry
fe2cf91d69
Fix PBD::copy_file so it works with non-ASCII filenames on windows
2014-08-17 18:43:27 -04:00
Tim Mayberry
aae3815a77
Add test utility function to PBD tests to return some utf-8 strings
...
This is currently unused
2014-08-17 18:43:22 -04:00
Tim Mayberry
1eca45d70e
Add a test for PBD::copy_file using test files with utf-8 encoded filenames
2014-08-17 18:43:06 -04:00
Tim Mayberry
3f6181c0c3
Fix PBD::copy_files so that it uses O_BINARY on windows and doesn't add line endings to copied files
2014-08-17 18:43:00 -04:00
Tim Mayberry
5598c12471
Use PLATFORM_WINDOWS define instead of WIN32 in PBD::FileManager
2014-08-17 18:42:54 -04:00
Tim Mayberry
999a5432fc
Call PBD::init and PBD::cleanup in pbd test executable
2014-08-17 18:42:49 -04:00
Tim Mayberry
7cdb4ed199
Add test for PBD::copy_file
...
From this I can see that PBD::copy_file is not working correctly on windows
as it is adding windows style line endings. Adding O_BINARY to ::open flags
would fix it, but perhaps there is a better way...
2014-08-17 18:42:43 -04:00
Tim Mayberry
439f68bdc9
Add utility function to test lib to create a test directory
...
There is an identical function in libardour test support lib so we
should probably find a better place to put this at some point
2014-08-17 18:42:38 -04:00
Tim Mayberry
17a984aa30
Change PBD::get_files and PBD::get_paths to take a Searchpath instead of directory path
...
Both these functions use the internal function run_functor_for_paths
which takes a Searchpath so this avoids a temporary variable in cases
where a Searchpath is passed directly.
The usage is the same as the compiler will generate a temporary Searchpath
from a string(directory path) if necessary.
2014-08-17 18:42:33 -04:00
Tim Mayberry
1308cccd96
Add/Update docs in pbd/file_utils.h
2014-08-17 18:42:25 -04:00
Tim Mayberry
257a2710eb
Use run_functor_for_paths in PBD::get_paths
2014-08-17 18:42:21 -04:00
Tim Mayberry
849adaf7e5
Rename PBD::get_files_in_directory to just PBD::get_files, change parameter order and fix docs
2014-08-17 18:42:08 -04:00
Tim Mayberry
b668c53c5c
Rename PBD::get_directory_contents to PBD::get_paths
...
shorter name and change order of parameters to match other functions
2014-08-17 18:42:01 -04:00
Tim Mayberry
0228ddb52f
Use run_functor_for_paths in PBD::find_files_matching_pattern
2014-08-17 18:41:56 -04:00
Tim Mayberry
5450da010b
Add function PBD::find_paths_matching_filter
2014-08-17 18:41:47 -04:00
Tim Mayberry
8fe666a930
Use run_functor_for_paths in PBD::find_files_matching_filter
2014-08-17 18:41:41 -04:00
Tim Mayberry
ca8750a5d1
Add function to file_utils intended to be used internally
2014-08-17 18:41:36 -04:00
Tim Mayberry
49681b96ee
Add some debug output in file_utils.cc
2014-08-17 18:41:31 -04:00
Tim Mayberry
3fadc0f2e1
Remove reference to strtok_r now that it isn't used
2014-08-17 18:41:25 -04:00
Tim Mayberry
f921717e68
Change formatting of DEBUG_TRACE calls to match style guide
2014-08-17 18:41:20 -04:00
Tim Mayberry
8864cfc626
Move functions in pbd/clear_dir.h/cc into pbd/file_utils.h/cc
...
Conflicts:
libs/pbd/clear_dir.cc
2014-08-17 18:41:13 -04:00
Tim Mayberry
bf927c2561
Add remove_directory_internal function and use it in PBD::clear_directory and PBD::remove_directory
...
Conflicts:
libs/pbd/clear_dir.cc
2014-08-17 18:39:30 -04:00
Tim Mayberry
7aa71c4d7d
Reimplement PBD::clear_dir using PBD::get_directory_contents
2014-08-17 18:37:07 -04:00
Tim Mayberry
dbcc1f1d39
Rename PBD::find_file_in_search_path to just PBD::find_file
...
saves a bit of typing and not necessary if you look at how it is used.
Conflicts:
gtk2_ardour/about.cc
gtk2_ardour/session_dialog.cc
libs/pbd/system_exec.cc
2014-08-17 18:36:02 -04:00
Tim Mayberry
093fb77b88
Use PBD::find_files_matching_pattern instead of other variations
2014-08-17 18:12:40 -04:00
Tim Mayberry
1a4fdf0b22
Add a variation of PBD::find_files_matching_pattern for convenience
2014-08-17 18:12:34 -04:00
Tim Mayberry
a6c2609068
Add new function PBD::find_files_matching_pattern
...
This new function is intended to replace the three existing
PBD::find_matching_files_* functions.
The order of parameters matches find_files_matching_regex and
find_files_matching_filter
2014-08-17 18:12:26 -04:00
Tim Mayberry
c126e8cc45
Change PBD::find_files_matching_regex and PBD::find_files_matching_filter to take a Searchpath
2014-08-17 18:12:19 -04:00
Tim Mayberry
ce36eee9ab
Reimplement PBD::find_files_matching_filter using SearchPath and get_directory_contents
2014-08-17 18:12:14 -04:00
Tim Mayberry
9597f5468d
Remove limit parameter from PBD::find_files_matching_regex
...
This limit was not used or documented. The same functionality can be
performed when iterating through the results.
2014-08-17 18:12:09 -04:00
Tim Mayberry
ef6d6816aa
Remove parameters from PBD::find_files_matching_regex
...
The only users of this API always used the same options so just remove
them.
2014-08-17 18:12:04 -04:00
Tim Mayberry
4ffa970135
Change PBD::get_files_in_directory to return full paths in result
...
get_files_in_directory uses get_directory_contents internally now
2014-08-17 18:11:59 -04:00
Tim Mayberry
1e442feb53
Add PBD::get_directory_contents to pbd/file_utils.h
2014-08-17 18:11:52 -04:00
John Emmas
f80271b0df
Remove (no longer needed) sources from an MSVC project
2014-08-17 16:24:56 -04:00
John Emmas
8d0e77a4d8
Move the definition for 'strtok_r' (to avoid clashing with a different definition in pthread_win32)
2014-08-17 16:24:48 -04:00
Tim Mayberry
9b0308a6aa
Remove PathScanner class from libpbd
2014-08-17 15:32:50 -04:00
Tim Mayberry
10a6fe553e
Replace all use of PathScanner with equivalent functions from pbd/file_utils.h
2014-08-17 15:32:42 -04:00
Tim Mayberry
2339fdc1aa
Add default arguments to match those in PathScanner::operator()
2014-08-17 15:32:29 -04:00
Tim Mayberry
e75f227fe3
Move member functions from PathScanner to functions in pbd/file_utils.h
...
This allows us to remove PathScanner source file and keep PathScanner class
as header only until it is removed
2014-08-17 15:32:25 -04:00
Tim Mayberry
2334880bc9
Move PathScanner::operator() into header
2014-08-17 15:32:20 -04:00
Tim Mayberry
7974046301
Remove unused methods in PathScanner
...
Now that these methods are only a few lines it doesn't make much sense
to keep them seeing as they are unused. There are also functions with
near identical functionality in pbd/file_utils.h
2014-08-17 15:32:16 -04:00
Tim Mayberry
b2eb0d80be
Rename PathScanner::run_scan_internal to PathScanner::find_files_matching_filter
2014-08-17 15:32:13 -04:00
Tim Mayberry
51fbb8a352
Remove PathScanner::run_scan and use PathScanner::run_scan_internal directly
2014-08-17 15:32:08 -04:00
Tim Mayberry
e5d4a16594
Add PathScanner::find_files_matching_regex and move regexp usage to one place
2014-08-17 15:32:01 -04:00
Tim Mayberry
144da83bc8
Remove member filter argument from PathScanner methods and use normal filter for regex
...
Also use regfree to free memory of compiled patterns
2014-08-17 15:31:56 -04:00