@@ -7,15 +7,66 @@ use crate::io::{self, Error, ErrorKind};
7
7
use crate :: io:: { BorrowedCursor , IoSlice , IoSliceMut , SeekFrom } ;
8
8
use crate :: os:: hermit:: io:: { AsFd , AsRawFd , BorrowedFd , FromRawFd , IntoRawFd , RawFd } ;
9
9
use crate :: path:: { Path , PathBuf } ;
10
- use crate :: sys:: common:: small_c_string:: run_path_with_cstr;
11
10
use crate :: sys:: cvt;
12
11
use crate :: sys:: time:: SystemTime ;
13
12
use crate :: sys:: unsupported;
14
13
use crate :: sys_common:: { AsInner , AsInnerMut , FromInner , IntoInner } ;
15
14
16
- pub use crate :: sys_common:: fs:: { copy, try_exists} ;
17
15
//pub use crate::sys_common::fs::remove_dir_all;
18
16
17
+ pub ( crate ) mod fs_imp {
18
+ pub ( crate ) use super :: {
19
+ DirBuilder , DirEntry , File , FileAttr , FilePermissions , FileTimes , FileType , OpenOptions ,
20
+ ReadDir ,
21
+ } ;
22
+ use crate :: io;
23
+ use crate :: path:: { AsPath , PathBuf } ;
24
+ use crate :: sys:: unsupported;
25
+
26
+ pub ( crate ) fn remove_file < P : AsPath > ( _path : P ) -> io:: Result < ( ) > {
27
+ unsupported ( )
28
+ }
29
+ pub ( crate ) fn symlink_metadata < P : AsPath > ( _path : P ) -> io:: Result < FileAttr > {
30
+ unsupported ( )
31
+ }
32
+ pub ( crate ) fn metadata < P : AsPath > ( _path : P ) -> io:: Result < FileAttr > {
33
+ unsupported ( )
34
+ }
35
+ pub ( crate ) fn rename < P : AsPath , Q : AsPath > ( _from : P , _to : Q ) -> io:: Result < ( ) > {
36
+ unsupported ( )
37
+ }
38
+ pub ( crate ) fn hard_link < P : AsPath , Q : AsPath > ( _original : P , _link : Q ) -> io:: Result < ( ) > {
39
+ unsupported ( )
40
+ }
41
+ pub ( crate ) fn soft_link < P : AsPath , Q : AsPath > ( _original : P , _link : Q ) -> io:: Result < ( ) > {
42
+ unsupported ( )
43
+ }
44
+ pub ( crate ) fn remove_dir < P : AsPath > ( _path : P ) -> io:: Result < ( ) > {
45
+ unsupported ( )
46
+ }
47
+ pub ( crate ) fn read_dir < P : AsPath > ( _path : P ) -> io:: Result < ReadDir > {
48
+ unsupported ( )
49
+ }
50
+ pub ( crate ) fn set_permissions < P : AsPath > ( _path : P , _perms : FilePermissions ) -> io:: Result < ( ) > {
51
+ unsupported ( )
52
+ }
53
+ pub ( crate ) fn copy < P : AsPath , Q : AsPath > ( _from : P , _to : Q ) -> io:: Result < u64 > {
54
+ unsupported ( )
55
+ }
56
+ pub ( crate ) fn canonicalize < P : AsPath > ( _path : P ) -> io:: Result < PathBuf > {
57
+ unsupported ( )
58
+ }
59
+ pub ( crate ) fn remove_dir_all < P : AsPath > ( _path : P ) -> io:: Result < ( ) > {
60
+ unsupported ( )
61
+ }
62
+ pub ( crate ) fn read_link < P : AsPath > ( _path : P ) -> io:: Result < PathBuf > {
63
+ unsupported ( )
64
+ }
65
+ pub ( crate ) fn try_exists < P : AsPath > ( _path : P ) -> io:: Result < bool > {
66
+ unsupported ( )
67
+ }
68
+ }
69
+
19
70
#[ derive( Debug ) ]
20
71
pub struct File ( FileDesc ) ;
21
72
@@ -268,11 +319,7 @@ impl OpenOptions {
268
319
}
269
320
270
321
impl File {
271
- pub fn open ( path : & Path , opts : & OpenOptions ) -> io:: Result < File > {
272
- run_path_with_cstr ( path, & |path| File :: open_c ( & path, opts) )
273
- }
274
-
275
- pub fn open_c ( path : & CStr , opts : & OpenOptions ) -> io:: Result < File > {
322
+ pub fn open_native ( path : & CStr , opts : & OpenOptions ) -> io:: Result < File > {
276
323
let mut flags = opts. get_access_mode ( ) ?;
277
324
flags = flags | opts. get_creation_mode ( ) ?;
278
325
@@ -415,52 +462,3 @@ impl FromRawFd for File {
415
462
Self ( FromRawFd :: from_raw_fd ( raw_fd) )
416
463
}
417
464
}
418
-
419
- pub fn readdir ( _p : & Path ) -> io:: Result < ReadDir > {
420
- unsupported ( )
421
- }
422
-
423
- pub fn unlink ( path : & Path ) -> io:: Result < ( ) > {
424
- run_path_with_cstr ( path, & |path| cvt ( unsafe { abi:: unlink ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
425
- }
426
-
427
- pub fn rename ( _old : & Path , _new : & Path ) -> io:: Result < ( ) > {
428
- unsupported ( )
429
- }
430
-
431
- pub fn set_perm ( _p : & Path , perm : FilePermissions ) -> io:: Result < ( ) > {
432
- match perm. 0 { }
433
- }
434
-
435
- pub fn rmdir ( _p : & Path ) -> io:: Result < ( ) > {
436
- unsupported ( )
437
- }
438
-
439
- pub fn remove_dir_all ( _path : & Path ) -> io:: Result < ( ) > {
440
- //unsupported()
441
- Ok ( ( ) )
442
- }
443
-
444
- pub fn readlink ( _p : & Path ) -> io:: Result < PathBuf > {
445
- unsupported ( )
446
- }
447
-
448
- pub fn symlink ( _original : & Path , _link : & Path ) -> io:: Result < ( ) > {
449
- unsupported ( )
450
- }
451
-
452
- pub fn link ( _original : & Path , _link : & Path ) -> io:: Result < ( ) > {
453
- unsupported ( )
454
- }
455
-
456
- pub fn stat ( _p : & Path ) -> io:: Result < FileAttr > {
457
- unsupported ( )
458
- }
459
-
460
- pub fn lstat ( _p : & Path ) -> io:: Result < FileAttr > {
461
- unsupported ( )
462
- }
463
-
464
- pub fn canonicalize ( _p : & Path ) -> io:: Result < PathBuf > {
465
- unsupported ( )
466
- }
0 commit comments