Return early from ephemeral so we can dedent this code.
This commit is contained in:
parent
3eb83a6289
commit
2eaac9e996
1 changed files with 10 additions and 8 deletions
|
@ -1601,16 +1601,18 @@ class PhotoDB(
|
||||||
if self.ephemeral:
|
if self.ephemeral:
|
||||||
existing_database = False
|
existing_database = False
|
||||||
self.sql = sqlite3.connect(':memory:')
|
self.sql = sqlite3.connect(':memory:')
|
||||||
else:
|
self._first_time_setup()
|
||||||
self.database_filepath = self.data_directory.with_child(constants.DEFAULT_DBNAME)
|
return
|
||||||
existing_database = self.database_filepath.exists
|
|
||||||
|
|
||||||
if not existing_database and not create:
|
self.database_filepath = self.data_directory.with_child(constants.DEFAULT_DBNAME)
|
||||||
msg = f'"{self.database_filepath.absolute_path}" does not exist and create is off.'
|
existing_database = self.database_filepath.exists
|
||||||
raise FileNotFoundError(msg)
|
|
||||||
|
|
||||||
self.data_directory.makedirs(exist_ok=True)
|
if not existing_database and not create:
|
||||||
self.sql = sqlite3.connect(self.database_filepath.absolute_path)
|
msg = f'"{self.database_filepath.absolute_path}" does not exist and create is off.'
|
||||||
|
raise FileNotFoundError(msg)
|
||||||
|
|
||||||
|
self.data_directory.makedirs(exist_ok=True)
|
||||||
|
self.sql = sqlite3.connect(self.database_filepath.absolute_path)
|
||||||
|
|
||||||
if existing_database:
|
if existing_database:
|
||||||
if not skip_version_check:
|
if not skip_version_check:
|
||||||
|
|
Loading…
Reference in a new issue