Added support for mothballing puzzles containing files with spaces in their filenames and creating mothball path if it doesn't exist.

This commit is contained in:
Jack Miner 2019-03-24 20:34:01 -06:00
parent 5afae5b666
commit db2cc99cc7
3 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import os
import random
import string
import tempfile
import shlex
messageChars = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
@ -112,7 +113,7 @@ class Puzzle:
elif key == 'name':
pass
elif key == 'file':
parts = val.split()
parts = shlex.split(val)
name = parts[0]
hidden = False
stream = open(name, 'rb')

View File

@ -59,6 +59,9 @@ def build_category(categorydir, outdir):
mothball = package(categoryname, categorydir, category_seed)
shutil.copyfileobj(mothball, zipfileraw)
zipfileraw.close()
zipfiledir = os.path.dirname(zipfilename)
if not os.path.exists(zipfiledir):
os.makedirs(zipfiledir)
shutil.move(zipfileraw.name, zipfilename)

View File

@ -5,6 +5,7 @@ Being in this list is voluntary. Add your name when you contribute code.
* Paul Ferrell
* Shannon Steinfadt
* John Donaldson
* 3ch01c
Word List
---------