#1726 On startup, application no longer auto-creates SDRTrunk folder and system properties in user's home directory when user has changed the application root in the user preferences.

This commit is contained in:
Dennis Sheirer
2023-11-11 06:17:04 -05:00
parent 2347135614
commit a1a6b3e988
3 changed files with 11 additions and 27 deletions

View File

@@ -156,18 +156,10 @@ public class SDRTrunk implements Listener<TunerEvent>
}
}
//Setup the application home directory
Path home = getHomePath();
ThreadPool.logSettings();
mLog.info("Home path: " + home.toString());
//Load properties file
if(home != null)
{
loadProperties(home);
}
loadProperties();
//Log current properties setting
SystemProperties.getInstance().logCurrentSettings();
@@ -632,34 +624,30 @@ public class SDRTrunk implements Listener<TunerEvent>
* Loads the application properties file from the user's home directory,
* creating the properties file for the first-time, if necessary
*/
private void loadProperties(Path homePath)
private void loadProperties()
{
Path propsPath = homePath.resolve("SDRTrunk.properties");
Path propertiesPath = mUserPreferences.getDirectoryPreference().getDirectoryApplicationRoot().resolve("SDRTrunk.properties");
if(!Files.exists(propsPath))
if(!Files.exists(propertiesPath))
{
try
{
mLog.info("SDRTrunk - creating application properties file [" +
propsPath.toAbsolutePath() + "]");
Files.createFile(propsPath);
mLog.info("SDRTrunk - creating application properties file [" + propertiesPath.toAbsolutePath() + "]");
Files.createFile(propertiesPath);
}
catch(IOException e)
{
mLog.error("SDRTrunk - couldn't create application properties "
+ "file [" + propsPath.toAbsolutePath(), e);
mLog.error("SDRTrunk - couldn't create application properties file [" + propertiesPath.toAbsolutePath(), e);
}
}
if(Files.exists(propsPath))
if(Files.exists(propertiesPath))
{
SystemProperties.getInstance().load(propsPath);
SystemProperties.getInstance().load(propertiesPath);
}
else
{
mLog.error("SDRTrunk - couldn't find or recreate the SDRTrunk " +
"application properties file");
mLog.error("SDRTrunk - couldn't find or recreate the SDRTrunk application properties file");
}
}