@@ -41,17 +41,21 @@ def exit_error(error):
41
41
exit ()
42
42
43
43
def readConfigFile ():
44
- config_path = os .path .expanduser ('~' ) + '/.config/gccnicerc' ;
44
+ config_path = os .path .expanduser ('~' ) + '/.config/' ;
45
+ config_filename = 'gccnicerc'
45
46
46
47
try :
47
- config_file = open (config_path , 'r' )
48
+ config_file = open (config_path + config_filename , 'r' )
48
49
config_json = json .loads (config_file .read ())
50
+
49
51
for key in config :
50
52
if key in config_json :
51
53
config [key ] = config_json [key ]
52
54
except :
53
- config_file = open (config_path , 'w' )
54
- config_file .write (json .dumps (default_config , indent = 4 ))
55
+ os .makedirs (config_path , exist_ok = True )
56
+
57
+ config_file = open (config_path + config_filename , 'w' )
58
+ config_file .write (json .dumps (config , indent = 4 ))
55
59
config_file .close ()
56
60
57
61
def getTerminalWidth ():
@@ -64,7 +68,7 @@ def readMessageJson():
64
68
65
69
try :
66
70
return json .loads (gcc_output )
67
- except :
71
+ except : # This is not a compiler error and was not JSON-formatted.
68
72
print (gcc_output )
69
73
exit ()
70
74
@@ -80,10 +84,11 @@ def wrap(text, text_width, horizontal = ' ', vertical = ' ',
80
84
+ top_right
81
85
+ '\n ' )
82
86
83
- final += '\n ' .join ((vertical if wrap_horizontal else '' )
87
+ vertical_char = vertical if wrap_horizontal else ''
88
+ final += '\n ' .join (vertical_char
84
89
+ line
85
90
+ ' ' * (text_width - len (removeColorSequences (line )))
86
- + ( vertical if wrap_horizontal else '' )
91
+ + vertical_char
87
92
for line in text .split ('\n ' ))
88
93
89
94
if (wrap_vertical ):
0 commit comments