Skip to content

Commit

Permalink
Merge pull request #1779 from HosseinAssaran/master
Browse files Browse the repository at this point in the history
Update example in fs.md and use target_family instead of target_os
  • Loading branch information
marioidival authored Dec 13, 2023
2 parents 800e7e1 + 578d3f7 commit 64d7c4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/std_misc/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
});
Expand Down

0 comments on commit 64d7c4a

Please sign in to comment.