mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpiutil] DataLogBackgroundWriter: Normalize empty path name (#7151)
An empty path isn't valid on it's own, so fs::space always returns an error. This results in UINT_MAX bytes being used instead of the actual free space, which means a default constructed DataLogBackgroundWriter won't stop for low space. Using "." instead makes the directory path the current working directory, which is the desired behavior
This commit is contained in:
@@ -176,7 +176,8 @@ static std::string MakeRandomFilename() {
|
||||
}
|
||||
|
||||
struct DataLogBackgroundWriter::WriterThreadState {
|
||||
explicit WriterThreadState(std::string_view dir) : dirPath{dir} {}
|
||||
explicit WriterThreadState(std::string_view dir)
|
||||
: dirPath{dir.empty() ? "." : dir} {}
|
||||
WriterThreadState(const WriterThreadState&) = delete;
|
||||
WriterThreadState& operator=(const WriterThreadState&) = delete;
|
||||
~WriterThreadState() { Close(); }
|
||||
|
||||
Reference in New Issue
Block a user