From f2a90174bb36b9ad528e863ab34c02ebce002b02 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 15 Jun 2018 18:57:24 +0200 Subject: Update for latest nightly 2018-06-09 (#70) * Update for latest nightly 2018-06-09 * We now have a proper horizon os and sys modules in libstd --- ctr-std/src/sys/cloudabi/shims/os.rs | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 ctr-std/src/sys/cloudabi/shims/os.rs (limited to 'ctr-std/src/sys/cloudabi/shims/os.rs') diff --git a/ctr-std/src/sys/cloudabi/shims/os.rs b/ctr-std/src/sys/cloudabi/shims/os.rs new file mode 100644 index 0000000..1e355d9 --- /dev/null +++ b/ctr-std/src/sys/cloudabi/shims/os.rs @@ -0,0 +1,95 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use error::Error as StdError; +use ffi::{OsStr, OsString}; +use fmt; +use io; +use iter; +use path::{self, PathBuf}; +use sys::{unsupported, Void}; + +pub fn getcwd() -> io::Result { + unsupported() +} + +pub fn chdir(_: &path::Path) -> io::Result<()> { + unsupported() +} + +pub type Env = iter::Empty<(OsString, OsString)>; + +pub fn env() -> Env { + iter::empty() +} + +pub fn getenv(_: &OsStr) -> io::Result> { + Ok(None) +} + +pub fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> { + unsupported() +} + +pub fn unsetenv(_: &OsStr) -> io::Result<()> { + unsupported() +} + +pub struct SplitPaths<'a>(&'a Void); + +pub fn split_paths(_unparsed: &OsStr) -> SplitPaths { + panic!("unsupported") +} + +impl<'a> Iterator for SplitPaths<'a> { + type Item = PathBuf; + fn next(&mut self) -> Option { + match *self.0 {} + } +} + +#[derive(Debug)] +pub struct JoinPathsError; + +pub fn join_paths(_paths: I) -> Result +where + I: Iterator, + T: AsRef, +{ + Err(JoinPathsError) +} + +impl fmt::Display for JoinPathsError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + "not supported on CloudABI yet".fmt(f) + } +} + +impl StdError for JoinPathsError { + fn description(&self) -> &str { + "not supported on CloudABI yet" + } +} + +pub fn home_dir() -> Option { + None +} + +pub fn temp_dir() -> PathBuf { + PathBuf::from("/tmp") +} + +pub fn current_exe() -> io::Result { + unsupported() +} + +pub fn getpid() -> u32 { + 1 +} -- cgit v1.2.3