From d604db441014c2270c9fc63a08337996f0a92a2d Mon Sep 17 00:00:00 2001 From: panicbit Date: Sat, 20 Aug 2016 04:36:14 +0200 Subject: [PATCH] Add len method to fs File --- src/services/fs.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/services/fs.rs b/src/services/fs.rs index 247a5b1..ac84667 100644 --- a/src/services/fs.rs +++ b/src/services/fs.rs @@ -113,6 +113,18 @@ impl Archive { } impl File { + pub fn len(&self) -> Result { + unsafe { + let mut len = 0; + let r = FSFILE_GetSize(self.handle, &mut len); + if r < 0 { + Err(r) + } else { + Ok(len) + } + } + } + pub fn read(&mut self, buf: &mut [u8]) -> Result { unsafe { let mut n_read = 0;