Skip to content

Commit 5705f14

Browse files
author
Jackson
committed
doesn't look for abbreviated folder until it looks for long version
1 parent a399bdf commit 5705f14

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/classes/assets.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,25 @@ def get_assets_path(file_path=None, create_paths=True):
4040
# Generate asset folder name filename + "_assets"
4141
file_path = file_path
4242
asset_filename = os.path.splitext(os.path.basename(file_path))[0]
43-
asset_folder_name = asset_filename + "_assets"
43+
asset_folder_name = asset_filename[:248] + "_assets" #Windows max name size is 255. 248 = 255 - len("_assets")
4444
asset_path = os.path.join(os.path.dirname(file_path), asset_folder_name)
4545

4646
# Previous Assets File Name Convention.
4747
asset_folder_name_30_char = asset_filename[:30] + "_assets"
4848
asset_path_30_char = os.path.join(os.path.dirname(file_path), asset_folder_name_30_char)
4949

50+
5051
# Create asset folder, if necessary
5152
if create_paths:
5253

53-
if os.path.exists(asset_path_30_char):
54+
if not os.path.exists(asset_path):
55+
if os.path.exists(asset_folder_name_30_char):
5456
#update assets folder, if it follows the previous naming convention
55-
os.rename(asset_path_30_char, asset_path)
56-
log.info("Updating 30 character path to full length {}".format(asset_path))
57-
elif not os.path.exists(asset_path):
58-
os.mkdir(asset_path)
59-
log.info("Asset dir created as {}".format(asset_path))
57+
os.rename(asset_path_30_char, asset_path)
58+
log.info("Updating 30 character path to full length {}".format(asset_path))
59+
else:
60+
os.mkdir(asset_path)
61+
log.info("Asset dir created as {}".format(asset_path))
6062
else:
6163
log.info("Using existing asset folder {}".format(asset_path))
6264

0 commit comments

Comments
 (0)