s
This commit is contained in:
1 parent
e9c5ed9a4c
commit
fc8e56da41
5 files changed
-5219
No files matched your search
Generated
-5165
File diff suppressed because it is too large.
Load diff
@@ -1,11 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "native_media_viewer"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
anyhow = "1.0.104"
|
|
||||||
eframe = "0.37.0"
|
|
||||||
egui_extras = "0.37.0"
|
|
||||||
image = "0.25.10"
|
|
||||||
rfd = "0.18.0"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
use std::fs;
|
|
||||||
use std::path::Path;
|
|
||||||
use serde::Serialize;
|
|
||||||
use anyhow::Result;
|
|
||||||
|
|
||||||
#[derive(Serialize, Clone, Debug)]
|
|
||||||
pub struct FileInfo {
|
|
||||||
pub name: String,
|
|
||||||
pub path: String,
|
|
||||||
pub is_dir: bool,
|
|
||||||
pub extension: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn list_files(dir_path: &str) -> Result<Vec<FileInfo>> {
|
|
||||||
let path = Path::new(dir_path);
|
|
||||||
let mut files = Vec::new();
|
|
||||||
|
|
||||||
if path.is_dir() {
|
|
||||||
for entry in fs::read_dir(path)? {
|
|
||||||
let entry = entry?;
|
|
||||||
let metadata = entry.metadata()?;
|
|
||||||
let file_name = entry.file_name().to_string_lossy().into_owned();
|
|
||||||
let file_path = entry.path().to_string_lossy().into_owned();
|
|
||||||
|
|
||||||
files.push(FileInfo {
|
|
||||||
name: file_name,
|
|
||||||
path: file_path,
|
|
||||||
is_dir: metadata.is_dir(),
|
|
||||||
extension: entry.path().extension().map(|s| s.to_string_lossy().into_owned()),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(files)
|
|
||||||
}
|
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "image",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user