mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #968 from pypeclub/bugfix/3.0_create_project_structure_action
Create project structure action fix multiroot
This commit is contained in:
commit
a1a203d502
1 changed files with 13 additions and 7 deletions
|
|
@ -86,11 +86,11 @@ class CreateProjectFolders(BaseAction):
|
|||
try:
|
||||
# Get paths based on presets
|
||||
basic_paths = self.get_path_items(project_folder_structure)
|
||||
anatomy = Anatomy(project_entity["full_name"])
|
||||
self.create_folders(basic_paths, project_entity, anatomy)
|
||||
self.create_folders(basic_paths, project_entity)
|
||||
self.create_ftrack_entities(basic_paths, project_entity)
|
||||
|
||||
except Exception as exc:
|
||||
self.log.warning("Creating of structure crashed.", exc_info=True)
|
||||
session.rollback()
|
||||
return {
|
||||
"success": False,
|
||||
|
|
@ -220,10 +220,11 @@ class CreateProjectFolders(BaseAction):
|
|||
output.append(os.path.normpath(os.path.sep.join(clean_items)))
|
||||
return output
|
||||
|
||||
def create_folders(self, basic_paths, project, anatomy):
|
||||
def create_folders(self, basic_paths, project):
|
||||
anatomy = Anatomy(project["full_name"])
|
||||
roots_paths = []
|
||||
if isinstance(anatomy.roots, dict):
|
||||
for root in anatomy.roots:
|
||||
for root in anatomy.roots.values():
|
||||
roots_paths.append(root.value)
|
||||
else:
|
||||
roots_paths.append(anatomy.roots.value)
|
||||
|
|
@ -233,9 +234,14 @@ class CreateProjectFolders(BaseAction):
|
|||
full_paths = self.compute_paths(basic_paths, project_root)
|
||||
# Create folders
|
||||
for path in full_paths:
|
||||
if os.path.exists(path):
|
||||
continue
|
||||
os.makedirs(path.format(project_root=project_root))
|
||||
full_path = path.format(project_root=project_root)
|
||||
if os.path.exists(full_path):
|
||||
self.log.debug(
|
||||
"Folder already exists: {}".format(full_path)
|
||||
)
|
||||
else:
|
||||
self.log.debug("Creating folder: {}".format(full_path))
|
||||
os.makedirs(full_path)
|
||||
|
||||
|
||||
def register(session):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue