std/sys/pal/unsupported/
os.rs

1use super::unsupported;
2use crate::error::Error as StdError;
3use crate::ffi::{OsStr, OsString};
4use crate::marker::PhantomData;
5use crate::path::{self, PathBuf};
6use crate::{fmt, io};
7
8pub fn errno() -> i32 {
9    0
10}
11
12pub fn error_string(_errno: i32) -> String {
13    "operation successful".to_string()
14}
15
16pub fn getcwd() -> io::Result<PathBuf> {
17    unsupported()
18}
19
20pub fn chdir(_: &path::Path) -> io::Result<()> {
21    unsupported()
22}
23
24pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
25
26pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
27    panic!("unsupported")
28}
29
30impl<'a> Iterator for SplitPaths<'a> {
31    type Item = PathBuf;
32    fn next(&mut self) -> Option<PathBuf> {
33        self.0
34    }
35}
36
37#[derive(Debug)]
38pub struct JoinPathsError;
39
40pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
41where
42    I: Iterator<Item = T>,
43    T: AsRef<OsStr>,
44{
45    Err(JoinPathsError)
46}
47
48impl fmt::Display for JoinPathsError {
49    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50        "not supported on this platform yet".fmt(f)
51    }
52}
53
54impl StdError for JoinPathsError {
55    #[allow(deprecated)]
56    fn description(&self) -> &str {
57        "not supported on this platform yet"
58    }
59}
60
61pub fn current_exe() -> io::Result<PathBuf> {
62    unsupported()
63}
64
65pub fn temp_dir() -> PathBuf {
66    panic!("no filesystem on this platform")
67}
68
69pub fn home_dir() -> Option<PathBuf> {
70    None
71}
72
73pub fn exit(_code: i32) -> ! {
74    crate::intrinsics::abort()
75}
76
77pub fn getpid() -> u32 {
78    panic!("no pids on this platform")
79}