Extension name now support dot

This commit is contained in:
2025-07-22 10:32:18 +08:00
parent 42041dc965
commit 6cd356d52d
2 changed files with 21 additions and 5 deletions

View File

@@ -73,7 +73,7 @@ impl ScriptBuilder for ScnScriptBuilder {
} }
fn extensions(&self) -> &'static [&'static str] { fn extensions(&self) -> &'static [&'static str] {
&["scn"] &["ks.scn"]
} }
fn script_type(&self) -> &'static ScriptType { fn script_type(&self) -> &'static ScriptType {

View File

@@ -15,8 +15,16 @@ pub fn find_files(path: &str, recursive: bool, no_ext_filter: bool) -> io::Resul
if path.is_file() if path.is_file()
&& (no_ext_filter && (no_ext_filter
|| path.extension().map_or(true, |ext| { || path.file_name().map_or(false, |file| {
ALL_EXTS.contains(&ext.to_string_lossy().to_lowercase()) path.extension().map_or(true, |_| {
let file = file.to_string_lossy().to_lowercase();
for ext in ALL_EXTS.iter() {
if file.ends_with(&format!(".{}", ext)) {
return true;
}
}
false
})
})) }))
{ {
if let Some(path_str) = path.to_str() { if let Some(path_str) = path.to_str() {
@@ -45,8 +53,16 @@ pub fn find_arc_files(path: &str, recursive: bool) -> io::Result<Vec<String>> {
let path = entry.path(); let path = entry.path();
if path.is_file() if path.is_file()
&& path.extension().map_or(false, |ext| { && path.file_name().map_or(false, |file| {
ARCHIVE_EXTS.contains(&ext.to_string_lossy().to_lowercase()) path.extension().map_or(true, |_| {
let file = file.to_string_lossy().to_lowercase();
for ext in ARCHIVE_EXTS.iter() {
if file.ends_with(&format!(".{}", ext)) {
return true;
}
}
false
})
}) })
{ {
if let Some(path_str) = path.to_str() { if let Some(path_str) = path.to_str() {