forked from FlxVctr/RADICES
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_config.py
More file actions
36 lines (32 loc) · 1.24 KB
/
make_config.py
File metadata and controls
36 lines (32 loc) · 1.24 KB
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
import os
import subprocess
import sys
from shutil import copyfile
# creates a new empty config file and opens it
def make_config():
copyfile('config_template.yml', 'config.yml')
if __name__ == '__main__':
i = 0
while True:
if i == 0:
answer = input('''This program will create a new config.yml.\n
After running it, you will be asked with which program to\n
open the new file. Please choose your standard text editor.\n
Do you wish to create a new config.yml now? (y/n): ''')
else:
answer = input('''Sorry, I did not get your input. Do you wish to create \n
a new config.yml now? Pleaser answer y for yes or n for no: ''')
if answer == "n":
break
elif answer == "y":
make_config()
if sys.platform.startswith('darwin'):
subprocess.call(('open', "config.yml"))
elif os.name == 'nt': # For Windows
os.startfile("config.yml")
elif os.name == 'posix': # For Linux, Mac, etc.
subprocess.call(('xdg-open', "config.yml"))
break
else:
i = 1
pass