Add detailed database path debugging and file access testing

This commit is contained in:
Jarian Cottingham 2026-02-02 21:35:54 -06:00
parent ef35b5e8ef
commit 11ba31de61

View File

@ -21,6 +21,7 @@ class DatabaseManager:
self._init_database() self._init_database()
except Exception as e: except Exception as e:
print(f"Warning: Database initialization failed: {e}") print(f"Warning: Database initialization failed: {e}")
print(f"Database path being used: {self.config.path}")
# Create the directory if it doesn't exist and the path has a directory component # Create the directory if it doesn't exist and the path has a directory component
import os import os
try: try:
@ -32,8 +33,16 @@ class DatabaseManager:
# If no directory, ensure current directory is writable # If no directory, ensure current directory is writable
os.makedirs('.', exist_ok=True) os.makedirs('.', exist_ok=True)
print("Verified current directory is writable") print("Verified current directory is writable")
# Try to test if we can create the file
test_path = os.path.abspath(self.config.path)
print(f"Testing database file access at: {test_path}")
# Try to create a simple test file to verify permissions
with open(test_path, 'w') as f:
f.write('')
os.remove(test_path)
print("Database file access test successful")
except Exception as dir_error: except Exception as dir_error:
print(f"Warning: Could not create database directory: {dir_error}") print(f"Warning: Could not create database directory or test access: {dir_error}")
# Re-raise the original error # Re-raise the original error
raise raise