Remove any previous temporary files

main
Bob Mottram 2021-05-30 12:39:09 +01:00
parent ad72231aef
commit 8804849a8d
1 changed files with 3 additions and 2 deletions

View File

@ -24,8 +24,9 @@ def importTheme(baseDir: str, filename: str) -> bool:
if not os.path.isfile(filename):
return False
tempThemeDir = baseDir + '/imports/files'
if not os.path.isdir(tempThemeDir):
os.mkdir(tempThemeDir)
if os.path.isdir(tempThemeDir):
rmtree(tempThemeDir)
os.mkdir(tempThemeDir)
unpack_archive(filename, tempThemeDir, 'zip')
essentialThemeFiles = ('name.txt', 'theme.json')
for themeFile in essentialThemeFiles: