Skip to content

Commit

Permalink
Improve file-browser code
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaJewson committed May 6, 2023
1 parent eaffdc0 commit c1ea101
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/file-browser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ impl Entry {
false => FileType::File,
};
let icon_name = if api.supports_image(&file_name) {
let mut res = Vec::new();
//res.extend(b"file://");
res.extend_from_slice(entry.path().as_os_str().as_bytes());
let mut res = entry.path().into_os_string().into_vec();
res.push(0);
Some(CString::from_vec_with_nul(res).unwrap())
} else {
Expand All @@ -166,5 +164,5 @@ use std::env;
use std::ffi::CString;
use std::ffi::OsString;
use std::fs;
use std::os::unix::prelude::OsStrExt;
use std::os::unix::ffi::OsStringExt as _;
use std::path::PathBuf;

0 comments on commit c1ea101

Please sign in to comment.