Skip to content

Commit

Permalink
Skip through single root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrwach committed Dec 6, 2023
1 parent dd523e3 commit e9fb2fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ fn main() -> Result<()> {
process::exit(res.to_exit_code());
}

fn paths_from(paths: Vec<PathBuf>, cross_filesystems: bool) -> Result<Vec<PathBuf>, io::Error> {
fn paths_from(mut paths: Vec<PathBuf>, cross_filesystems: bool) -> Result<Vec<PathBuf>, io::Error> {
let device_id = std::env::current_dir()
.ok()
.and_then(|cwd| crossdev::init(&cwd).ok());

if paths.len() == 1 {
std::env::set_current_dir(&paths[0])?;
paths.remove(0);
}

if paths.is_empty() {
cwd_dirlist().map(|paths| match device_id {
Some(device_id) if !cross_filesystems => paths
Expand Down

0 comments on commit e9fb2fd

Please sign in to comment.