|
|
@ -273,10 +273,12 @@ pub fn file_browser(root: PathBuf) -> Result<FilePicker, std::io::Error> {
|
|
|
|
let columns = [PickerColumn::new(
|
|
|
|
let columns = [PickerColumn::new(
|
|
|
|
"path",
|
|
|
|
"path",
|
|
|
|
|item: &PathBuf, root: &PathBuf| {
|
|
|
|
|item: &PathBuf, root: &PathBuf| {
|
|
|
|
item.strip_prefix(root)
|
|
|
|
let name = item.strip_prefix(root).unwrap_or(item).to_string_lossy();
|
|
|
|
.unwrap_or(item)
|
|
|
|
if item.is_dir() {
|
|
|
|
.to_string_lossy()
|
|
|
|
format!("{}/", name).into()
|
|
|
|
.into()
|
|
|
|
} else {
|
|
|
|
|
|
|
|
name.into()
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)];
|
|
|
|
)];
|
|
|
|
let picker = Picker::new(
|
|
|
|
let picker = Picker::new(
|
|
|
@ -316,11 +318,10 @@ fn directory_content(path: &Path) -> Result<Vec<PathBuf>, std::io::Error> {
|
|
|
|
let mut dirs = Vec::new();
|
|
|
|
let mut dirs = Vec::new();
|
|
|
|
let mut files = Vec::new();
|
|
|
|
let mut files = Vec::new();
|
|
|
|
for entry in std::fs::read_dir(path)?.flatten() {
|
|
|
|
for entry in std::fs::read_dir(path)?.flatten() {
|
|
|
|
let entry_path = entry.path();
|
|
|
|
|
|
|
|
if entry.path().is_dir() {
|
|
|
|
if entry.path().is_dir() {
|
|
|
|
dirs.push(entry_path);
|
|
|
|
dirs.push(entry.path());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
files.push(entry_path);
|
|
|
|
files.push(entry.path());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dirs.sort();
|
|
|
|
dirs.sort();
|
|
|
@ -328,7 +329,6 @@ fn directory_content(path: &Path) -> Result<Vec<PathBuf>, std::io::Error> {
|
|
|
|
|
|
|
|
|
|
|
|
let mut content = Vec::new();
|
|
|
|
let mut content = Vec::new();
|
|
|
|
if path.parent().is_some() {
|
|
|
|
if path.parent().is_some() {
|
|
|
|
log::warn!("{}", path.to_string_lossy());
|
|
|
|
|
|
|
|
content.insert(0, path.join(".."));
|
|
|
|
content.insert(0, path.join(".."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
content.extend(dirs);
|
|
|
|
content.extend(dirs);
|
|
|
|