File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,6 @@ def create(cls, path: Path | str) -> "SourcetrailDB":
194
194
# Create project directory
195
195
obj .project_dir = obj .path .parent
196
196
obj .files_directory = Path (str (obj .path .stem ) + cls .SOURCETRAIL_PROJECT_DIR )
197
- Path (obj .project_dir , obj .files_directory ).mkdir (mode = 0o755 , exist_ok = True )
198
197
# Commit change to the database so we don't ended up with a half setup DB if
199
198
# an exceptions is raised before the next commit
200
199
obj .commit ()
@@ -1323,6 +1322,10 @@ def associate_file_to_node(
1323
1322
break
1324
1323
sha256 .update (data )
1325
1324
hash = sha256 .hexdigest ()
1325
+
1326
+ if not self .files_directory .exists (): # Create directory on first write
1327
+ self .files_directory .mkdir (mode = 0o755 , exist_ok = True )
1328
+
1326
1329
file_path = f"{ self .files_directory } /{ hash } "
1327
1330
dest = f"{ self .project_dir } /{ file_path } "
1328
1331
You can’t perform that action at this time.
0 commit comments