diff --git a/src/std_misc/fs.md b/src/std_misc/fs.md index e078e36edc..ba2d4b4fac 100644 --- a/src/std_misc/fs.md +++ b/src/std_misc/fs.md @@ -7,9 +7,9 @@ use std::fs; use std::fs::{File, OpenOptions}; use std::io; use std::io::prelude::*; -#[cfg(target_os = "unix")] +#[cfg(target_family = "unix")] use std::os::unix; -#[cfg(target_os = "windows")] +#[cfg(target_family = "windows")] use std::os::windows; use std::path::Path; @@ -65,12 +65,12 @@ fn main() { println!("`ln -s ../b.txt a/c/b.txt`"); // Create a symbolic link, returns `io::Result<()>` - #[cfg(target_os = "unix")] { + #[cfg(target_family = "unix")] { unix::fs::symlink("../b.txt", "a/c/b.txt").unwrap_or_else(|why| { println!("! {:?}", why.kind()); }); } - #[cfg(target_os = "windows")] { + #[cfg(target_family = "windows")] { windows::fs::symlink_file("../b.txt", "a/c/b.txt").unwrap_or_else(|why| { println!("! {:?}", why.to_string()); });