Setup backwards compatiblity with old libresonic.home

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 8 years ago
parent 348411cc0d
commit 5447141718
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 16
      airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java
  2. 3
      airsonic-main/src/main/resources/applicationContext-db-legacy.xml
  3. 3
      airsonic-main/src/test/resources/applicationContext-testdb.xml

@ -240,8 +240,11 @@ public class SettingsService {
File home;
String overrideHome = System.getProperty("airsonic.home");
String oldHome = System.getProperty("libresonic.home");
if (overrideHome != null) {
home = new File(overrideHome);
} else if(oldHome != null) {
home = new File(oldHome);
} else {
boolean isWindows = System.getProperty("os.name", "Windows").toLowerCase().startsWith("windows");
home = isWindows ? AIRSONIC_HOME_WINDOWS : AIRSONIC_HOME_OTHER;
@ -251,9 +254,18 @@ public class SettingsService {
return home;
}
public static String getFileSystemAppName() {
String home = getAirsonicHome().getPath();
return home.contains("libresonic") ? "libresonic" : "airsonic";
}
public static String getDefaultJDBCUrl() {
return "jdbc:hsqldb:file:" + getAirsonicHome().getPath() + "/db/" + getFileSystemAppName();
}
public static File getLogFile() {
File airsonicHome = SettingsService.getAirsonicHome();
return new File(airsonicHome, "airsonic.log");
return new File(airsonicHome, getFileSystemAppName() + ".log");
}
@ -298,7 +310,7 @@ public class SettingsService {
public static File getPropertyFile() {
File propertyFile = getAirsonicHome();
return new File(propertyFile, "airsonic.properties");
return new File(propertyFile, getFileSystemAppName() + ".properties");
}
private int getInt(String key, int defaultValue) {

@ -8,7 +8,8 @@
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:#{T(org.airsonic.player.service.SettingsService).airsonicHome.path}/db/airsonic" />
<property name="url"
value="#{T(org.airsonic.player.service.SettingsService).defaultJDBCUrl}" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>

@ -7,7 +7,8 @@
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:#{systemProperties['airsonic.home']}/db/airsonic" />
<property name="url"
value="#{T(org.airsonic.player.service.SettingsService).defaultJDBCUrl}" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>

Loading…
Cancel
Save