-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconvert.R
33 lines (24 loc) · 876 Bytes
/
convert.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(rjson)
library(stringr)
library(readr)
source('functions.R')
# User-defined objects --------------------------------------------------------
# keyboard name:
# keyboardName <- 'lily58'
keyboardName <- 'keebio-iris'
# json file name:
# jsonFileName <- 'lily58_rev1_jhelvy'
jsonFileName <- 'keebio_iris_rev2_jhelvy'
# Folder name
folderName <- 'jhelvy'
# Run -------------------------------------------------------------------------
# Define the file paths
jsonFile <- paste0(jsonFileName, '.json')
keymapFile <- paste0(jsonFileName, '.txt')
jsonFilePath <- file.path('keyboards', keyboardName, folderName, jsonFile)
keymapFilePath <- file.path('keyboards', keyboardName, folderName, keymapFile)
# Get converted keymap
keymap_json <- fromJSON(file = jsonFilePath)
keymap_txt <- makeKeymap(keymap_json)
# Save as .txt file
writeLines(keymap_txt, keymapFilePath)