File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,12 +43,11 @@ fn main() {
4343
4444#[ tauri:: command]
4545async fn get_stellaris_colors_cmd ( path : String ) -> Result < Vec < String > , String > {
46- let paths = get_stellaris_data_paths (
47- Path :: new ( & path) . to_path_buf ( ) ,
48- Path :: new ( "flags" ) . to_path_buf ( ) ,
49- FileFilter :: Name ( OsString :: from ( "colors.txt" ) ) ,
50- 1 ,
51- ) ;
46+ let paths: Vec < PathBuf > = get_stellaris_data_dirs ( Path :: new ( & path) . to_path_buf ( ) )
47+ . into_iter ( )
48+ . map ( |p| p. join ( "flags" ) . join ( "colors.txt" ) )
49+ . filter ( |p| p. exists ( ) )
50+ . collect ( ) ;
5251 if paths. is_empty ( ) {
5352 return Err ( String :: from ( "No color files found" ) ) ;
5453 }
@@ -207,7 +206,6 @@ fn get_sub_dirs(path: &PathBuf) -> anyhow::Result<Vec<PathBuf>> {
207206}
208207
209208enum FileFilter {
210- Name ( OsString ) ,
211209 Extension ( OsString ) ,
212210}
213211
@@ -226,10 +224,6 @@ fn get_files_matching_filter(
226224 files. append ( & mut sub_dir_files) ;
227225 } else {
228226 match filter {
229- FileFilter :: Name ( filter_name) => match path. file_name ( ) {
230- Some ( name) if name == filter_name => files. push ( path) ,
231- _ => ( ) ,
232- } ,
233227 FileFilter :: Extension ( filter_ext) => match path. extension ( ) {
234228 Some ( ext) if ext == filter_ext => files. push ( path) ,
235229 _ => ( ) ,
You can’t perform that action at this time.
0 commit comments