Skip to content

Commit 9f8a1cb

Browse files
committed
Use os::getcwd instead of env in rustbook (fixup #22727)
1 parent f8e4fcb commit 9f8a1cb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/rustbook/build.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//! Implementation of the `build` subcommand, used to compile a book.
1212
1313
use std::env;
14+
use std::os;
1415
use std::old_io;
1516
use std::old_io::{fs, File, BufferedWriter, TempDir, IoResult};
1617

@@ -81,7 +82,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
8182

8283
let src;
8384
if env::args().len() < 3 {
84-
src = env::current_dir().unwrap().clone();
85+
src = os::getcwd().unwrap().clone();
8586
} else {
8687
src = Path::new(env::args().nth(2).unwrap().clone());
8788
}
@@ -149,7 +150,7 @@ impl Subcommand for Build {
149150
}
150151
fn usage(&self) {}
151152
fn execute(&mut self, term: &mut Term) -> CommandResult<()> {
152-
let cwd = env::current_dir().unwrap();
153+
let cwd = os::getcwd().unwrap();
153154
let src;
154155
let tgt;
155156

src/rustbook/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(core)]
1414
#![feature(old_io)]
1515
#![feature(env)]
16+
#![feature(os)]
1617
#![feature(old_path)]
1718
#![feature(rustdoc)]
1819

src/rustbook/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use error::Error;
1717
use term::Term;
1818
use book;
1919
use std::old_io::{Command, File};
20-
use std::env;
20+
use std::os;
2121

2222
struct Test;
2323

@@ -35,7 +35,7 @@ impl Subcommand for Test {
3535
}
3636
fn usage(&self) {}
3737
fn execute(&mut self, term: &mut Term) -> CommandResult<()> {
38-
let cwd = env::current_dir().unwrap();
38+
let cwd = os::getcwd().unwrap();
3939
let src = cwd.clone();
4040

4141
let summary = File::open(&src.join("SUMMARY.md"));

0 commit comments

Comments
 (0)