Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/ConfigFile.java @ 608:e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 07 May 2013 21:27:51 +0200 |
parents | 0205a5c4566b |
children | 6526d8adbc0f |
comparison
equal
deleted
inserted
replaced
607:66f1cc23b906 | 608:e1b29756f901 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011-2012 TMate Software Ltd | 2 * Copyright (c) 2011-2013 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
181 | 181 |
182 private String sectionName = ""; | 182 private String sectionName = ""; |
183 private Map<String,String> section = new LinkedHashMap<String, String>(); | 183 private Map<String,String> section = new LinkedHashMap<String, String>(); |
184 private File contextFile; | 184 private File contextFile; |
185 | 185 |
186 // TODO "" and lists | 186 // TODO [post-1.1] "" and lists |
187 // XXX perhaps, single string to keep whole section with substrings for keys/values to minimize number of arrays (String.value) | 187 // XXX perhaps, single string to keep whole section with substrings for keys/values to minimize number of arrays (String.value) |
188 public boolean consume(String line, ConfigFile cfg) throws IOException { | 188 public boolean consume(String line, ConfigFile cfg) throws IOException { |
189 int x; | 189 int x; |
190 if ((x = line.indexOf('#')) != -1) { | 190 if ((x = line.indexOf('#')) != -1) { |
191 // do not keep comments in memory, get new, shorter string | 191 // do not keep comments in memory, get new, shorter string |
235 } | 235 } |
236 | 236 |
237 // include failure doesn't propagate | 237 // include failure doesn't propagate |
238 private void processInclude(String includeValue, ConfigFile cfg) { | 238 private void processInclude(String includeValue, ConfigFile cfg) { |
239 File f; | 239 File f; |
240 // TODO handle environment variable expansion | 240 // TODO [post-1.1] handle environment variable expansion |
241 if (includeValue.startsWith("~/")) { | 241 if (includeValue.startsWith("~/")) { |
242 f = new File(System.getProperty("user.home"), includeValue.substring(2)); | 242 f = new File(System.getProperty("user.home"), includeValue.substring(2)); |
243 } else { | 243 } else { |
244 f = new File(contextFile.getParentFile(), includeValue); | 244 f = new File(contextFile.getParentFile(), includeValue); |
245 } | 245 } |