13
0
Commit Graph

87 Commits

Author SHA1 Message Date
d257c8c0ce
Prevent endless recursive directory scans
This can happen when a folder symlinks to itself or subfolders
in some similar recursive pattern.
2024-09-08 01:33:57 +02:00
ac004eee70 avoid all potential charset conversion when displaying an error relating to filename errors 2024-05-22 15:59:49 -06:00
63b5c9ea2b
Trying to track down mysterious cxxabiv1::failed_throw
It seems that a `Glib::ConvertError` is thrown, and then the
function that catches the error causes another ConvertError in
`err.what()` (which presumably include the filename that
causes the error).

relevant part of the backtrace (macOS Crashdump):

```
Glib::ConvertError::throw_func(_GError*) + 56
Glib::Error::throw_exception(_GError*) + 292
Glib::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Glib::ustring const&) + 131
StringPrivate::Composition& StringPrivate::Composition::arg<Glib::ustring>(Glib::ustring const&) + 25
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > string_compose<Glib::ustring> (...) + 81
PBD::run_functor_for_paths(...) + 1313
```
2024-05-22 18:36:15 +02:00
John Emmas
ea8742b030 #include <sys/utime.h> when building with MSVC 2023-09-27 09:36:26 +01:00
6494214622
Add option to prefer file timestamps with recursive copy 2023-09-27 02:22:22 +02:00
473f575a05
Catch Glib::ConvertError when checking for files
This fixes some edge-cases when scanning recent sessions
in get_state_files_in_directory() and likely some other
places that use run_functor_for_paths in case the folder
contains files with non UTF-8 names.
2023-04-03 22:10:11 +02:00
c69cfaa124
Fix Ardour's rm -r implementation, delete symlinks 2022-11-19 20:20:58 +01:00
mx
262281bc1f
Use soundtouch for vocal audio time stretching (1/2) 2020-08-26 19:04:58 +02:00
26b6b8d840
mingw/gcc-8: use glib's stat(), drop hardlink support 2020-03-13 01:21:51 +01:00
d979c9d09c
Fix win32, mingw/gcc-8.3 builds 2020-03-11 07:20:00 +01:00
ffbf40c3d1
Add PBD API to hard-link files 2019-08-12 16:41:25 +02:00
0301c47f6b
Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
7c3fd2fe79 Glib throws a const FileError exception 2018-10-26 13:40:03 +02:00
506a29e2d3 Don't recurse into MacVST bundle-folders during plugin-scan 2017-09-21 20:02:11 +02:00
569167a603 Move PBD::canonical_path to pbd/file_utils.h/cc and reimplement for Windows
This fixes the libpbd testCanonicalPathUTF8 and libardour
open_session_utf8_path unit tests

You can now have Sessions with localized names containing characters that
aren't in the system codepage on Windows.

It also fixes the issue where a Session would not open when it was moved into a
path with characters that aren't in the system codepage.

The only use case for calling canonical_path/realpath on the session path
AFAICT is for resolving relative paths that are passed via the command
line/terminal. I'm doubtful that works correctly on Windows because of
character encoding issues with the current API we use for that(not glib), so it
is slightly ironic that this issue was caused by an incorrect implementation of
a function that is not really necessary on Windows at this point in time.
2016-09-19 14:47:52 +10:00
cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
740c4dd134 possible fix for invalid cleanup space calc on win32. 2015-10-20 15:50:00 +02:00
af3ffc8610 NOOP, re-indent 2015-10-20 15:49:59 +02:00
2397429e99 use quotes for in-tree pbd/glib wrapper include 2015-10-05 22:15:18 +02:00
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
e344d379d2 update semantics of PBD::remove_directory()
Remove the directory recursively including itself. The function
is used in two places only:

* LV2Plugin::add_state() -- no change, remove tmp. state
* Session::save_as()  -- on error, remove target

In both cases removing the folder itself is correct.
2015-09-27 12:44:54 +02:00
7ac691ec82 use pbd's gstdio compatibility wrapper 2015-09-17 14:37:57 +02:00
009a06a773 Move ARDOUR::touch_file to pbd/file_utils.h 2015-07-26 12:15:19 +10:00
5188f02cfe hide issues with g_close() not being available in somewhat older versions of glib 2015-03-16 13:34:35 -05:00
8ff477ab1a add PBD::toggle_file_existence() 2015-03-16 13:00:28 -05:00
f694b867c1 Fix PBD::copy_file on windows to work with non-ascii paths
This breakage was indicated by the filesystem unit tests.
2015-03-08 22:46:26 +10:00
cf7d5dbc2d recursive regexp file search. 2015-03-03 19:54:27 +01:00
2689848ed7 Add an extra test to prevent 'PBD::path_is_within()' from looping infinitely on Windows
The infinite loop would happen if the 2 supplied paths were on different Windows drives - for example if one was on drive C:\ and the other on drive E:\

I don't think this new test will be detrimental to the other platforms but if it is, we could easily separate it out with a '#ifdef PLATFORM_WINDOWS' directive.
2015-02-03 11:57:38 +00:00
0fa5643d20 move ScopedFileDescriptor into libpbd and use it 2014-12-14 12:26:00 -05:00
294b99aabf remove file manager LRU cache from code.
This was a very clever attempt to fix a non-problem. If the platform doesn't have enough file descriptors available
then the platform is broken and we're not going to hack around trying to fix it.
2014-12-10 18:28:55 -05:00
1abe8f4e42 Add PBD::tmp_writable_directory utility function to pbd/file_utils.h/cc 2014-12-03 17:31:04 +07:00
6fbd0a62e4 recursive file copy function 2014-09-28 18:24:08 +02:00
66684c6690 Add PBD::get_suffix() for ripping file suffixes from paths 2014-07-08 12:24:56 -04:00
dcca72dabd Use 'GStatBuf' in preference to 'struct stat' (which isn't necessarily the same thing) 2014-06-28 13:33:28 +01:00
31bceb7570 Use PBD::FdFileDescriptor in PBD::copy_file 2014-06-25 12:40:11 -04:00
8da304be09 Fix PBD::copy_file so it works with non-ASCII filenames on windows 2014-06-25 12:40:11 -04:00
de4fc4843b Fix PBD::copy_files so that it uses O_BINARY on windows and doesn't add line endings to copied files 2014-06-25 12:40:11 -04:00
3b1a98f0ec 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-06-25 12:40:11 -04:00
6d0cce528e Add/Update docs in pbd/file_utils.h 2014-06-25 12:40:11 -04:00
851db83fc4 Use run_functor_for_paths in PBD::get_paths 2014-06-25 12:40:10 -04:00
04434f2b88 Rename PBD::get_files_in_directory to just PBD::get_files, change parameter order and fix docs 2014-06-25 12:40:10 -04:00
84d190b7cc Rename PBD::get_directory_contents to PBD::get_paths
shorter name and change order of parameters to match other functions
2014-06-25 12:40:10 -04:00
26ec4038af Use run_functor_for_paths in PBD::find_files_matching_pattern 2014-06-25 12:40:10 -04:00
24599c552d Add function PBD::find_paths_matching_filter 2014-06-25 12:40:10 -04:00
54c0a0144c Use run_functor_for_paths in PBD::find_files_matching_filter 2014-06-25 12:40:10 -04:00
e7141d2b80 Add function to file_utils intended to be used internally 2014-06-25 12:40:10 -04:00
ab6837665f Add some debug output in file_utils.cc 2014-06-25 12:40:10 -04:00
e6c4b0e9e4 Remove reference to strtok_r now that it isn't used 2014-06-25 12:40:10 -04:00
a226068959 Change formatting of DEBUG_TRACE calls to match style guide 2014-06-25 12:40:10 -04:00
cb3a604936 Move functions in pbd/clear_dir.h/cc into pbd/file_utils.h/cc 2014-06-25 12:40:10 -04:00