Fix crash if preset flag is not set
This commit is contained in:
1 parent
ae0f204828
commit
fb2479c65d
2 files changed
+6
-5
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"defaultDirectoryName":"NewProject",
|
"defaultDirectoryName":"NP",
|
||||||
"defaultFileName":"main.py",
|
"defaultFileName":"main.py",
|
||||||
"defaultPreset":"",
|
"defaultPreset":"",
|
||||||
"presetPath":"./presets"
|
"presetPath":"./presets"
|
||||||
|
|||||||
@@ -33,10 +33,11 @@ if __name__ == '__main__' :
|
|||||||
presetContent = ''
|
presetContent = ''
|
||||||
presetFile = Path().cwd().joinpath(f"{config['presetPath']}/{args.file_preset}.py")
|
presetFile = Path().cwd().joinpath(f"{config['presetPath']}/{args.file_preset}.py")
|
||||||
|
|
||||||
if not presetFile.exists() and args.file_preset == '' :
|
if args.file_preset != '' :
|
||||||
raise Exception(f"Preset {args.file_preset} does not exist!")
|
if not presetFile.exists() :
|
||||||
else :
|
raise Exception(f"Preset {args.file_preset} does not exist!")
|
||||||
presetContent = presetFile.read_text()
|
else :
|
||||||
|
presetContent = presetFile.read_text()
|
||||||
|
|
||||||
if not args.path :
|
if not args.path :
|
||||||
path = Path().cwd()
|
path = Path().cwd()
|
||||||
|
|||||||
Reference in new issue
Block a user