Skip to content

Commit 3f60738

Browse files
committed
fixed error in exeption handling
1 parent e83d1fc commit 3f60738

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

FT_Builder.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ def get_grandparent_folder(file_path):
124124
# Use os.path.dirname to get the parent directory
125125
grandparent_directory = os.path.dirname(os.path.dirname(file_path))
126126
return grandparent_directory
127+
128+
def get_first_folder_in_path(file_path):
129+
# Split the file path into its components
130+
path_components = os.path.normpath(file_path).split(os.path.sep)
131+
132+
# Find the first non-empty component (which represents a folder)
133+
for component in path_components:
134+
if component:
135+
return component
136+
137+
# If no folder is found, return None
138+
return None
127139

128140
#fonction that will take care of modifying the right lines of code in the patcher
129141
def modify_python_patcher_script(original_model_path, original_meta_file_path, diff_file_name, meta_diff_file_name, output_name, NameCustomScript):
@@ -378,7 +390,7 @@ def main():
378390

379391
except Exception as e:
380392

381-
delete_files_in_directory(os.path.abspath(os.path.join(os.path.dirname(__file__), NameCustomDir)))
393+
delete_files_in_directory(os.path.abspath(os.path.join(os.path.dirname(__file__), get_first_folder_in_path(get_grandparent_folder(get_assets_relative_path(FaceTrackedFBX))))))
382394

383395
delete_files_in_directory(os.path.abspath(os.path.join(os.path.dirname(__file__), 'build')))
384396

0 commit comments

Comments
 (0)