1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-10 17:33:57 +02:00

Avoid makeing empty folders for dxfs, stls or png if there are no parts of that type.

This commit is contained in:
Chris Palmer
2025-01-21 14:22:50 +00:00
parent 70fd7fbe14
commit 923c3b5c57
2 changed files with 18 additions and 10 deletions

View File

@@ -66,9 +66,16 @@ def make_parts(target, part_type, parts = None):
top_dir = set_config(target, lambda: usage(part_type))
target_dir = top_dir + part_type + 's'
deps_dir = target_dir + "/deps"
bom_dir = top_dir + "bom"
tmp_dir = mktmpdir(top_dir)
#
# Check we have some of this type
#
bom_dir = top_dir + "bom"
all_parts = bom_to_parts(bom_dir, part_type)
if not all_parts:
return
tmp_dir = mktmpdir(top_dir)
if not os.path.isdir(target_dir):
os.makedirs(target_dir)
@@ -83,7 +90,6 @@ def make_parts(target, part_type, parts = None):
#
# Decide which files to make
#
all_parts = bom_to_parts(bom_dir, part_type)
if parts:
targets = list(parts) #copy the list so we dont modify the list passed in
else:

View File

@@ -37,19 +37,21 @@ def usage():
sys.exit(1)
def render(target, type):
#
# Make the target directory
#
top_dir = set_config(target, usage)
tmp_dir = mktmpdir(top_dir)
target_dir = top_dir + type + 's'
bom_dir = top_dir + 'bom'
if not os.path.isdir(target_dir):
os.makedirs(target_dir)
#
# Find all the parts
#
parts = bom_to_parts(bom_dir, type)
if not parts:
return
#
# Make the target directory
#
tmp_dir = mktmpdir(top_dir)
target_dir = top_dir + type + 's'
if not os.path.isdir(target_dir):
os.makedirs(target_dir)
#
# Read the json bom to get the colours
#