@@ -80,7 +80,8 @@ static void reset() {
8080 Main .makeConsolePrintSilent = true ;
8181 String installDir = "../" ;
8282 try {
83- // if the default config is not the same as the current config, we must reset the storage layer
83+ // if the default config is not the same as the current config, we must reset
84+ // the storage layer
8485 File ogConfig = new File ("../temp/config.yaml" );
8586 File currentConfig = new File ("../config.yaml" );
8687 if (currentConfig .isFile ()) {
@@ -129,11 +130,12 @@ public void write(int b) {
129130 }
130131
131132 public static void setValueInConfig (String key , String value ) throws FileNotFoundException , IOException {
132- // we close the storage layer since there might be a change in the db related config.
133+ // we close the storage layer since there might be a change in the db related
134+ // config.
133135 StorageLayer .close ();
134136
135- String oldStr = "((#\\ s)?)" + key + "(:|((:\\ s).+))\n " ;
136- String newStr = key + ": " + value + "\n " ;
137+ String oldStr = "\n ((#\\ s)?)" + key + "(:|((:\\ s).+))\n " ;
138+ String newStr = " \n " + key + ": " + value + "\n " ;
137139 StringBuilder originalFileContent = new StringBuilder ();
138140 try (BufferedReader reader = new BufferedReader (new FileReader ("../config.yaml" ))) {
139141 String currentReadingLine = reader .readLine ();
@@ -149,11 +151,12 @@ public static void setValueInConfig(String key, String value) throws FileNotFoun
149151 }
150152
151153 public static void commentConfigValue (String key ) throws IOException {
152- // we close the storage layer since there might be a change in the db related config.
154+ // we close the storage layer since there might be a change in the db related
155+ // config.
153156 StorageLayer .close ();
154157
155- String oldStr = "((#\\ s)?)" + key + "(:|((:\\ s).+))\n " ;
156- String newStr = "# " + key + ":" ;
158+ String oldStr = "\n ((#\\ s)?)" + key + "(:|((:\\ s).+))\n " ;
159+ String newStr = "\n # " + key + ":" ;
157160
158161 StringBuilder originalFileContent = new StringBuilder ();
159162 try (BufferedReader reader = new BufferedReader (new FileReader ("../config.yaml" ))) {
0 commit comments