From ee0873ab366ccdf8a5bd7e712569cbddf34a7150 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sun, 2 Oct 2016 21:30:16 -0700 Subject: [PATCH] Make OpenOptions logic slightly less ugly --- src/services/fs.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/services/fs.rs b/src/services/fs.rs index 6bca22a..c52addf 100644 --- a/src/services/fs.rs +++ b/src/services/fs.rs @@ -453,9 +453,7 @@ impl OpenOptions { /// /// If both truncate and append are set to true, the file will simply be truncated pub fn append(&mut self, append: bool) -> &mut OpenOptions { - // we're going to be cheeky and just manually set write access here self.append = append; - self.write = append; self } @@ -536,7 +534,7 @@ impl OpenOptions { } fn get_open_flags(&self) -> u32 { - match (self.read, self.write, self.create) { + match (self.read, self.write || self.append, self.create) { (true, false, false) => FS_OPEN_READ, (false, true, false) => FS_OPEN_WRITE, (false, true, true) => FS_OPEN_WRITE | FS_OPEN_CREATE,