File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -190,22 +190,20 @@ impl OntoEnv {
190190 } ) ;
191191
192192 let config_path = path. unwrap_or_else ( || PathBuf :: from ( "." ) ) ;
193- let env = if let Some ( c) = config {
193+ let env = if let Some ( c) = config {
194194 // if temporary is true, create a new OntoEnv
195195 if c. cfg . temporary {
196196 OntoEnvRs :: init ( c. cfg , recreate) . map_err ( anyhow_to_pyerr)
197- } else if !recreate {
197+ } else if !recreate && config_path . join ( ".ontoenv" ) . exists ( ) {
198198 // if temporary is false, load from the directory
199- OntoEnvRs :: load_from_directory ( config_path, read_only)
200- . map_err ( anyhow_to_pyerr)
199+ OntoEnvRs :: load_from_directory ( config_path, read_only) . map_err ( anyhow_to_pyerr)
201200 } else {
202- // if temporary is false and recreate is true, create a new OntoEnv
201+ // if temporary is false and recreate is true or the directory doesn't exist , create a new OntoEnv
203202 OntoEnvRs :: init ( c. cfg , recreate) . map_err ( anyhow_to_pyerr)
204203 }
205204 } else {
206205 // If no config but a valid path is given, attempt to load from the directory
207- OntoEnvRs :: load_from_directory ( config_path, read_only)
208- . map_err ( anyhow_to_pyerr)
206+ OntoEnvRs :: load_from_directory ( config_path, read_only) . map_err ( anyhow_to_pyerr)
209207 } ?;
210208
211209 let inner = Arc :: new ( Mutex :: new ( env) ) ;
You can’t perform that action at this time.
0 commit comments