@@ -55,19 +55,21 @@ impl FileAttr {
5555 }
5656
5757 pub fn file_type ( & self ) -> FileType {
58- todo ! ( )
58+ FileType {
59+ is_dir : false ,
60+ }
5961 }
6062
6163 pub fn modified ( & self ) -> io:: Result < SystemTime > {
62- todo ! ( )
64+ unsupported ( )
6365 }
6466
6567 pub fn accessed ( & self ) -> io:: Result < SystemTime > {
66- todo ! ( )
68+ unsupported ( )
6769 }
6870
6971 pub fn created ( & self ) -> io:: Result < SystemTime > {
70- todo ! ( )
72+ unsupported ( )
7173 }
7274}
7375
@@ -146,11 +148,7 @@ impl OpenOptions {
146148 pub fn append ( & mut self , append : bool ) {
147149 self . append = append;
148150 }
149- pub fn truncate ( & mut self , truncate : bool ) {
150- if truncate {
151- panic ! ( "Truncation is not supported" )
152- }
153- }
151+ pub fn truncate ( & mut self , _truncate : bool ) { }
154152 pub fn create ( & mut self , create : bool ) {
155153 self . write = create;
156154 }
@@ -169,14 +167,9 @@ impl File {
169167 } ) ?;
170168
171169 if opts. create_new {
172- let file_exists = unsafe {
173- vex_sdk:: vexFileStatus ( path. as_ptr ( ) )
174- } ;
170+ let file_exists = unsafe { vex_sdk:: vexFileStatus ( path. as_ptr ( ) ) } ;
175171 if file_exists != 0 {
176- return Err ( io:: Error :: new (
177- io:: ErrorKind :: AlreadyExists ,
178- "File already exists"
179- ) )
172+ return Err ( io:: Error :: new ( io:: ErrorKind :: AlreadyExists , "File already exists" ) ) ;
180173 }
181174 }
182175
@@ -335,18 +328,11 @@ pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
335328}
336329
337330pub fn try_exists ( path : & Path ) -> io:: Result < bool > {
338- let path = CString :: new ( path. as_os_str ( ) . as_encoded_bytes ( ) ) . map_err ( |_| {
339- io:: Error :: new ( io:: ErrorKind :: InvalidData , "Path contained a null byte" )
340- } ) ?;
331+ let path = CString :: new ( path. as_os_str ( ) . as_encoded_bytes ( ) )
332+ . map_err ( |_| io:: Error :: new ( io:: ErrorKind :: InvalidData , "Path contained a null byte" ) ) ?;
341333
342- let file_exists = unsafe {
343- vex_sdk:: vexFileStatus ( path. as_ptr ( ) )
344- } ;
345- if file_exists != 0 {
346- Ok ( true )
347- } else {
348- Ok ( false )
349- }
334+ let file_exists = unsafe { vex_sdk:: vexFileStatus ( path. as_ptr ( ) ) } ;
335+ if file_exists != 0 { Ok ( true ) } else { Ok ( false ) }
350336}
351337
352338pub fn readlink ( _p : & Path ) -> io:: Result < PathBuf > {
@@ -368,10 +354,14 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
368354 let fd = file. fd . 0 ;
369355
370356 const SEEK_END : i32 = 2 ;
357+ const SEEK_SET : i32 = 0 ;
371358
372359 let end = unsafe {
360+ let cur = vex_sdk:: vexFileTell ( fd) ;
373361 map_fresult ( vex_sdk:: vexFileSeek ( fd, 0 , SEEK_END ) ) ?;
374- vex_sdk:: vexFileTell ( fd)
362+ let end = vex_sdk:: vexFileTell ( fd) ;
363+ map_fresult ( vex_sdk:: vexFileSeek ( fd, cur as _ , SEEK_SET ) ) ?;
364+ end
375365 } ;
376366
377367 if end >= 0 {
0 commit comments