forked from fjdogar/madpole
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmshortcutsConfig.py
40 lines (28 loc) · 1010 Bytes
/
mshortcutsConfig.py
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
34
35
36
37
38
39
40
import os
import string
import configparser
def getShortcuts():
config = configparser.ConfigParser()
mshortFolder = os.getcwd()
mshortConfigFile = os.path.join(mshortFolder, 'mshortcuts.ini')
print(mshortConfigFile)
if not os.path.exists(mshortConfigFile):
#Config file not found, create a new one
with open(mshortConfigFile, 'w') as newConfigFile:
config.write(newConfigFile)
# Double check that the config file now exists
if not os.path.exists(mshortConfigFile):
#TODO replace this with a proper exception
raise Exception
#open the config
config.read(mshortConfigFile)
data = config.items("arcade")
print(data)
print(list(zip(*data) )[1])
data = config.items("nes")
print(data)
print(list(zip(*data) )[1])
config['arcade']["1"] = "Adventure Island"
with open(mshortConfigFile, 'w') as newConfigFile:
config.write(newConfigFile)
getShortcuts()