mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
Fixed the file implementations, they weren't using a mode, and the base path was always set to /tmp/.
We now get the systems idea of where the users download folder is and use that as the base path when receiving a file. PiperOrigin-RevId: 406406731
This commit is contained in:
committed by
Copybara-Service
parent
acf516189b
commit
44fad7d8fb
@@ -27,7 +27,7 @@ namespace shared {
|
||||
// InputFile
|
||||
|
||||
InputFile::InputFile(const std::string& path, std::int64_t size)
|
||||
: file_(path), path_(path), total_size_(size) {}
|
||||
: file_(path, std::ios::binary), path_(path), total_size_(size) {}
|
||||
|
||||
ExceptionOr<ByteArray> InputFile::Read(std::int64_t size) {
|
||||
if (!file_.is_open()) {
|
||||
@@ -62,7 +62,8 @@ Exception InputFile::Close() {
|
||||
|
||||
// OutputFile
|
||||
|
||||
OutputFile::OutputFile(absl::string_view path) : file_(std::string(path)) {}
|
||||
OutputFile::OutputFile(absl::string_view path)
|
||||
: file_(std::string(path), std::ios::binary) {}
|
||||
|
||||
Exception OutputFile::Write(const ByteArray& data) {
|
||||
if (!file_.is_open()) {
|
||||
|
||||
Reference in New Issue
Block a user