Skip to content

Commit d2baac2

Browse files
committed
refactor(util)!: rename open_dir() to open_dir_following_links()
1 parent 5273260 commit d2baac2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/toolchain/toolchain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
currentprocess::{process, varsource::VarSource},
2020
env_var, install,
2121
notifications::Notification,
22-
utils::{raw::open_dir, utils},
22+
utils::{raw::open_dir_following_links, utils},
2323
RustupError,
2424
};
2525

@@ -62,7 +62,7 @@ impl<'a> Toolchain<'a> {
6262
let base_name = path
6363
.file_name()
6464
.ok_or_else(|| RustupError::InvalidToolchainName(name.to_string()))?;
65-
let parent_dir = match open_dir(parent) {
65+
let parent_dir = match open_dir_following_links(parent) {
6666
Ok(d) => d,
6767
Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(false),
6868
e => e?,

src/utils/raw.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn is_file<P: AsRef<Path>>(path: P) -> bool {
3131
}
3232

3333
#[cfg(windows)]
34-
pub fn open_dir(p: &Path) -> std::io::Result<File> {
34+
pub fn open_dir_following_links(p: &Path) -> std::io::Result<File> {
3535
use std::fs::OpenOptions;
3636
use std::os::windows::fs::OpenOptionsExt;
3737

@@ -42,8 +42,9 @@ pub fn open_dir(p: &Path) -> std::io::Result<File> {
4242
options.custom_flags(FILE_FLAG_BACKUP_SEMANTICS);
4343
options.open(p)
4444
}
45+
4546
#[cfg(not(windows))]
46-
pub fn open_dir(p: &Path) -> std::io::Result<File> {
47+
pub fn open_dir_following_links(p: &Path) -> std::io::Result<File> {
4748
use std::fs::OpenOptions;
4849

4950
let mut options = OpenOptions::new();

0 commit comments

Comments
 (0)