Skip to content

Commit

Permalink
fix files with improper encoding names from not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Jun 14, 2021
1 parent 362dc42 commit 1ce880f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/fs/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct JoshutoDirEntry {
impl JoshutoDirEntry {
pub fn from(direntry: &fs::DirEntry, show_icons: bool) -> std::io::Result<Self> {
let path = direntry.path();

let metadata = JoshutoMetadata::from(&path)?;
let name = direntry
.file_name()
Expand Down
9 changes: 3 additions & 6 deletions src/util/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ const fn no_filter(_: &Result<fs::DirEntry, std::io::Error>) -> bool {

fn filter_hidden(result: &Result<fs::DirEntry, std::io::Error>) -> bool {
match result {
Err(_) => false,
Err(_) => true,
Ok(entry) => {
let file_name = entry.file_name();
if let Some(file_name) = file_name.to_str() {
!file_name.starts_with('.')
} else {
false
}
let lossy_string = file_name.as_os_str().to_string_lossy();
!lossy_string.starts_with('.')
}
}
}

0 comments on commit 1ce880f

Please sign in to comment.