aboutsummaryrefslogtreecommitdiff
path: root/src/fs.h
AgeCommit message (Collapse)Author
2022-08-19fs: work around u8path deprecated-declaration warnings with libc++fanquake
When building in c++20 mode using libc++, the following warning is emitted: ```bash ./fs.h:72:29: warning: 'u8path<std::string>' is deprecated [-Wdeprecated-declarations] return std::filesystem::u8path(utf8_str); ^ /usr/lib/llvm-14/bin/../include/c++/v1/__filesystem/u8path.h:72:27: note: 'u8path<std::string>' has been explicitly marked deprecated here _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T ^ /usr/lib/llvm-14/bin/../include/c++/v1/__config:1042:43: note: expanded from macro '_LIBCPP_DEPRECATED_WITH_CHAR8_T' ^ /usr/lib/llvm-14/bin/../include/c++/v1/__config:1007:48: note: expanded from macro '_LIBCPP_DEPRECATED' ^ 1 warning generated. ``` as u8path<std::string> is deprecated starting with c++20. Fixes: #24682. Co-authored-by: MacroFake <falke.marco@gmail.com> Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-07-15Move FopenFn to fsbridge namespaceCarl Dong
[META] In a future commit in this patchset, it will be used by more than just validation, and it needs to align with fopen anyway.
2022-04-21Disallow more unsafe string->path conversions allowed by path append operatorsRyan Ofsky
Add more fs::path operator/ and operator+ overloads to prevent unsafe string->path conversions on Windows that would cause strings to be decoded according to the current Windows locale & code page instead of the correct string encoding. Update application code to deal with loss of implicit string->path conversions by calling fs::u8path or fs::PathFromString explicitly, or by just changing variable types from std::string to fs::path to avoid conversions altoghther, or make them happen earlier. In all cases, there's no change in behavior either (1) because strings only contained ASCII characters and would be decoded the same regardless of what encoding was used, or (2) because of the 1:1 mapping between paths and strings using the PathToString and PathFromString functions. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-03-24Make fs.h C++20 compliantMarcoFalke
Without the changes, the file will fail to compile under C++20 because char8_t can not be converted to char implicitly.
2022-02-17util: Work around libstdc++ create_directories issuelaanwj
Work around libstdc++ issue [PR101510] with create_directories where the leaf already exists as a symlink. Fixes #24257, introduced by the switch to `std::filesystem`. It is meant to be more thorough than #24266, which only worked around one instance of the problem. The issue was fixed upstream in https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=124eaa50e0a34f5f89572c1aa812c50979da58fc, but unfortunately we'll have to carry a fix for it for a while. This introduces a function `fs::create_directories` which wraps `std::filesystem::create_directories`. This allows easiliy reverting the workaround when it is no longer necessary.
2022-02-03refactor: replace boost::filesystem with std::filesystemKiminuo
Warning: Replacing fs::system_complete calls with fs::absolute calls in this commit may cause minor changes in behaviour because fs::absolute no longer strips trailing slashes; however these changes are believed to be safe. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-01-19fs: Make compatible with boost 1.78Andrew Chow
2022-01-10refactor: Block unsafe std::string fs::path conversion copy_file callsHennadii Stepanov
There is no change in behavior. This just helps prepare for the transition from boost::filesystem to std::filesystem by avoiding copy_file calls that will be unsafe after the transition to std::filesystem to due lack of a boost::filesystem::path::imbue equivalent and inability to set a predictable locale.
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-11-15Improve fs::PathToString documentationRussell Yanofsky
2021-10-05refactor: Block unsafe fs::path std::string conversion callsRussell Yanofsky
There is no change in behavior. This just helps prepare for the transition from boost::filesystem to std::filesystem by avoiding calls to methods which will be unsafe after the transaction to std::filesystem to due lack of a boost::filesystem::path::imbue equivalent and inability to set a predictable locale. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Kiminuo <kiminuo@protonmail.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2021-10-05refactor: Add fs::PathToString, fs::PathFromString, u8string, u8path functionsRussell Yanofsky
There is no change in behavior. This just helps prepare for the transition from the boost::filesystem to the std::filesystem path implementation. Co-authored-by: Kiminuo <kiminuo@protonmail.com>
2021-01-15Replace fs::absolute calls with AbsPathJoin callsKiminuo
This adds better test coverage and will make it easier in #20744 to remove our dependency on the two-argument boost::filesystem::absolute() function which does not have a direct equivalent in C++17.
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-12-11wallet: unbreak with boost 1.72Jan Beich
wallet/walletutil.cpp:77:23: error: no member named 'level' in 'boost::filesystem::recursive_directory_iterator' } else if (it.level() == 0 && it->symlink_status().type() == fs::regular_file && IsBerkeleyBtree(it... ~~ ^
2019-04-30Replace deprecated Boost Filesystem functionHennadii Stepanov
Boost Filesystem basename() function is deprecated since v1.36.0. Also, defining BOOST_FILESYSTEM_NO_DEPRECATED before including filesystem headers is strongly recommended. This prevents inadvertent use of old features, particularly legacy function names, that have been replaced and are going to go away in the future.
2018-12-29Update copyright headers to 2018DrahtBot
2018-11-20revert removal of fstream.hpp header in fs.hKarl-Johan Alm
This is required for some architectures.
2018-11-16Remove unreferenced boost headersMurray Nesbitt
2018-09-26utils: Add fsbridge fstream function wrapperChun Kuan Lee
2018-09-23Make fs::path::string() always return utf-8 stringChun Kuan Lee
2018-09-11utils: Convert fs error messages from multibyte to utf-8Chun Kuan Lee
2018-08-29Remove unused fsbridge::freopenpracticalswift
2018-08-28add unicode compatible file_lock for WindowsChun Kuan Lee
boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows. This commit add a new class to handle those specific file for Windows.
2017-05-19[Trivial] Add BITCOIN_FS_H endif footer in fs.hAhmad Kazi
2017-04-03Add fs.cpp/hWladimir J. van der Laan