@@ -6,7 +6,7 @@ use std::io::BufReader;
66
77use iced_aw:: TabLabel ;
88use chess:: { Piece , PROMOTION_PIECES } ;
9- use crate :: config:: load_config;
9+ use crate :: config:: { load_config, SETTINGS_FILE , PIECES_DIRECTORY } ;
1010use crate :: styles:: PieceTheme ;
1111use crate :: { Tab , Message , config, styles, lang, db, openings} ;
1212
@@ -197,11 +197,11 @@ pub fn gen_piece_vec(theme: &PieceTheme) -> Vec<Handle> {
197197 let mut handles = Vec :: < Handle > :: with_capacity ( 5 ) ;
198198 let theme_str = & theme. to_string ( ) ;
199199 // this first entry won't be used, it's there just to fill the vec, so we can index by the Piece
200- handles. insert ( 0 , Handle :: from_path ( "pieces/ cburnett/wP.svg") ) ;
201- handles. insert ( Piece :: Knight . to_index ( ) , Handle :: from_path ( String :: from ( "pieces/" ) + & theme_str + "/wN.svg" ) ) ;
202- handles. insert ( Piece :: Bishop . to_index ( ) , Handle :: from_path ( String :: from ( "pieces/" ) + & theme_str + "/wB.svg" ) ) ;
203- handles. insert ( Piece :: Rook . to_index ( ) , Handle :: from_path ( String :: from ( "pieces/" ) + & theme_str + "/wR.svg" ) ) ;
204- handles. insert ( Piece :: Queen . to_index ( ) , Handle :: from_path ( String :: from ( "pieces/" ) + & theme_str + "/wQ.svg" ) ) ;
200+ handles. insert ( 0 , Handle :: from_path ( String :: from ( PIECES_DIRECTORY ) + " cburnett/wP.svg") ) ;
201+ handles. insert ( Piece :: Knight . to_index ( ) , Handle :: from_path ( String :: from ( PIECES_DIRECTORY ) + & theme_str + "/wN.svg" ) ) ;
202+ handles. insert ( Piece :: Bishop . to_index ( ) , Handle :: from_path ( String :: from ( PIECES_DIRECTORY ) + & theme_str + "/wB.svg" ) ) ;
203+ handles. insert ( Piece :: Rook . to_index ( ) , Handle :: from_path ( String :: from ( PIECES_DIRECTORY ) + & theme_str + "/wR.svg" ) ) ;
204+ handles. insert ( Piece :: Queen . to_index ( ) , Handle :: from_path ( String :: from ( PIECES_DIRECTORY ) + & theme_str + "/wQ.svg" ) ) ;
205205 handles
206206}
207207
@@ -297,7 +297,7 @@ impl SearchTab {
297297 }
298298
299299 pub fn save_search_settings ( min_rating : i32 , max_rating : i32 , min_popularity : i32 , theme : TacticalThemes , opening : Openings , variation : Variation , op_side : Option < OpeningSide > ) {
300- let file = std:: fs:: File :: open ( "settings.json" ) ;
300+ let file = std:: fs:: File :: open ( SETTINGS_FILE ) ;
301301 if let Ok ( file) = file {
302302 let buf_reader = BufReader :: new ( file) ;
303303 if let Ok ( mut config) = serde_json:: from_reader :: < std:: io:: BufReader < std:: fs:: File > , config:: OfflinePuzzlesConfig > ( buf_reader) {
@@ -309,7 +309,7 @@ impl SearchTab {
309309 config. last_variation = variation;
310310 config. last_opening_side = op_side;
311311
312- let file = std:: fs:: File :: create ( "settings.json" ) ;
312+ let file = std:: fs:: File :: create ( SETTINGS_FILE ) ;
313313 if let Ok ( file) = file {
314314 if serde_json:: to_writer_pretty ( file, & config) . is_err ( ) {
315315 println ! ( "Error saving search options." ) ;
0 commit comments