File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
mistralrs-core/src/pipeline Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,21 @@ macro_rules! api_dir_list {
2626 . display( )
2727 . to_string( )
2828 . replace( "/" , "-" ) ;
29+
30+ let home_folder = if dirs:: home_dir( ) . is_some( ) {
31+ let mut path = dirs:: home_dir( ) . unwrap( ) ;
32+ path. push( ".cache/huggingface/hub/" ) ;
33+ if !path. exists( ) {
34+ let _ = std:: fs:: create_dir_all( & path) ;
35+ }
36+ path
37+ } else {
38+ "./" . into( )
39+ } ;
40+
2941 let cache_dir: std:: path:: PathBuf = std:: env:: var( "HF_HUB_CACHE" )
3042 . map( std:: path:: PathBuf :: from)
31- . unwrap_or( "~/.cache/huggingface/hub/" . into( ) ) ;
43+ . unwrap_or( home_folder . into( ) ) ;
3244 let cache_file = cache_dir. join( format!( "{sanitized_id}_repo_list.json" ) ) ;
3345 if std:: path:: Path :: new( & cache_file) . exists( ) {
3446 use std:: io:: Read ;
@@ -55,8 +67,8 @@ macro_rules! api_dir_list {
5567 } ;
5668 let json = serde_json:: to_string_pretty( & cache)
5769 . expect( "Could not serialize cache" ) ;
58- let _ = std:: fs:: write( & cache_file, json) ;
59- tracing:: info!( "write to cache file {:?}" , cache_file) ;
70+ let ret = std:: fs:: write( & cache_file, json) ;
71+ tracing:: info!( "write to cache file {:?}, {:?} " , cache_file, ret ) ;
6072 files
6173 } )
6274 . unwrap_or_else( |e| {
You can’t perform that action at this time.
0 commit comments