Skip to content

Commit

Permalink
Don't try to decode file path as UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed May 24, 2023
1 parent a8944c1 commit 7d140d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod helpers;

use std::ffi::{OsStr, OsString};
use std::io::{Read, Write};
use std::os::unix::prelude::OsStrExt;

Check failure on line 5 in src/main.rs

View workflow job for this annotation

GitHub Actions / FixNameCase project (windows-latest)

failed to resolve: could not find `unix` in `os`
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::{ops::RangeInclusive, str};
Expand Down Expand Up @@ -47,14 +49,15 @@ fn get_symbols(folder: &PathBuf) -> Result<Vec<String>> {
"-",
]);
let process = command.spawn()?;
let file_paths: Vec<String> = entries
let filepaths: Vec<OsString> = entries
.clone()
.into_iter()
.filter_map(|d| d.into_path().into_os_string().into_string().ok())
.map(|d| d.into_path().into_os_string())
.collect();
process
.stdin
.ok_or(eyre!("Failed to grab stdin"))?
.write_all(file_paths.join("\n").as_bytes())?;
.write_all(filepaths.join(OsStr::new("\n")).as_bytes())?;

Check failure on line 60 in src/main.rs

View workflow job for this annotation

GitHub Actions / FixNameCase project (windows-latest)

no method named `as_bytes` found for struct `OsString` in the current scope
let mut out = String::new();
process
.stdout
Expand Down

0 comments on commit 7d140d0

Please sign in to comment.