This commit is contained in:
Alvin-Zilverstand committed 2026-11-19 20:51:37 +01:00
1 parent 7e3a27cf6d
commit e9c5ed9a4c
42 files changed
+2055 -4654

No files matched your search

+5165
View File
File diff suppressed because it is too large. Load diff
+11
View File
@@ -0,0 +1,11 @@
[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"
+3
View File
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+34
View File
@@ -0,0 +1,34 @@
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)
}