aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/kle2json.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli/kle2json.py')
-rwxr-xr-xlib/python/qmk/cli/kle2json.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/kle2json.py b/lib/python/qmk/cli/kle2json.py
index 3ed6594e0..5268462f9 100755
--- a/lib/python/qmk/cli/kle2json.py
+++ b/lib/python/qmk/cli/kle2json.py
@@ -37,12 +37,12 @@ def kle2json(cli):
37 file_path = Path(os.environ['ORIG_CWD'], cli.args.filename) 37 file_path = Path(os.environ['ORIG_CWD'], cli.args.filename)
38 # Check for valid file_path for more graceful failure 38 # Check for valid file_path for more graceful failure
39 if not file_path.exists(): 39 if not file_path.exists():
40 return cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', str(file_path)) 40 return cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', file_path)
41 out_path = file_path.parent 41 out_path = file_path.parent
42 raw_code = file_path.open().read() 42 raw_code = file_path.open().read()
43 # Check if info.json exists, allow overwrite with force 43 # Check if info.json exists, allow overwrite with force
44 if Path(out_path, "info.json").exists() and not cli.args.force: 44 if Path(out_path, "info.json").exists() and not cli.args.force:
45 cli.log.error('File {fg_cyan}%s/info.json{style_reset_all} already exists, use -f or --force to overwrite.', str(out_path)) 45 cli.log.error('File {fg_cyan}%s/info.json{style_reset_all} already exists, use -f or --force to overwrite.', out_path)
46 return False 46 return False
47 try: 47 try:
48 # Convert KLE raw to x/y coordinates (using kle2xy package from skullydazed) 48 # Convert KLE raw to x/y coordinates (using kle2xy package from skullydazed)
@@ -69,7 +69,7 @@ def kle2json(cli):
69 # Replace layout in keyboard json 69 # Replace layout in keyboard json
70 keyboard = keyboard.replace('"LAYOUT_JSON_HERE"', layout) 70 keyboard = keyboard.replace('"LAYOUT_JSON_HERE"', layout)
71 # Write our info.json 71 # Write our info.json
72 file = open(str(out_path) + "/info.json", "w") 72 file = open(out_path + "/info.json", "w")
73 file.write(keyboard) 73 file.write(keyboard)
74 file.close() 74 file.close()
75 cli.log.info('Wrote out {fg_cyan}%s/info.json', str(out_path)) 75 cli.log.info('Wrote out {fg_cyan}%s/info.json', out_path)