X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FConfigurationLocator.java;h=967f93673d7da4d458798aa895cb4262ee61e1e5;hb=953de352675a4ad91fe307d816a4ea7780c94274;hp=2d7ed45e7b6b24435e4d255b13d12e8c7bf48844;hpb=465077535b431004c056301dd9576120fdc58876;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/ConfigurationLocator.java b/src/de/todesbaum/jsite/main/ConfigurationLocator.java index 2d7ed45..967f936 100644 --- a/src/de/todesbaum/jsite/main/ConfigurationLocator.java +++ b/src/de/todesbaum/jsite/main/ConfigurationLocator.java @@ -1,5 +1,5 @@ /* - * jSite - ConfigurationLocator.java - Copyright © 2011 David Roden + * jSite - ConfigurationLocator.java - Copyright © 2011–2012 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,8 +55,8 @@ public class ConfigurationLocator { /** * Creates a new configuration locator. If this class is loaded from a JAR - * file, {@link ConfigurationLocation#NEXT_TO_JAR_FILE} is added to the - * list of possible configuration file locations. + * file, {@link ConfigurationLocation#NEXT_TO_JAR_FILE} is added to the list + * of possible configuration file locations. * {@link ConfigurationLocation#HOME_DIRECTORY} is always added to this * list, {@link ConfigurationLocation#CUSTOM} has to be enabled by calling * {@link #setCustomLocation(String)}. @@ -90,12 +90,11 @@ public class ConfigurationLocator { /** * Returns whether the given location is valid. Certain locations (such as - * {@link ConfigurationLocation#NEXT_TO_JAR_FILE}) may be invalid in - * certain circumstances (such as the application not being run from a JAR - * file). A location being valid does not imply that a configuration file - * does exist at the given location, use - * {@link #hasFile(ConfigurationLocation)} to check for a configuration - * file at the desired location. + * {@link ConfigurationLocation#NEXT_TO_JAR_FILE}) may be invalid in certain + * circumstances (such as the application not being run from a JAR file). A + * location being valid does not imply that a configuration file does exist + * at the given location, use {@link #hasFile(ConfigurationLocation)} to + * check for a configuration file at the desired location. * * @param configurationLocation * The configuration location @@ -173,7 +172,10 @@ public class ConfigurationLocator { if (hasFile(ConfigurationLocation.HOME_DIRECTORY)) { return ConfigurationLocation.HOME_DIRECTORY; } - return defaultLocation; + if (isValidLocation(defaultLocation)) { + return defaultLocation; + } + return ConfigurationLocation.HOME_DIRECTORY; } }