Skip to content

Commit

Permalink
#1726 On startup, application no longer auto-creates SDRTrunk folder …
Browse files Browse the repository at this point in the history
…and system properties in user's home directory when user has changed the application root in the user preferences.
  • Loading branch information
Dennis Sheirer committed Nov 11, 2023
1 parent 2347135 commit a1a6b3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 10 additions & 22 deletions src/main/java/io/github/dsheirer/gui/SDRTrunk.java
Expand Up @@ -156,18 +156,10 @@ public SDRTrunk()
}
}

//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();
Expand Down Expand Up @@ -632,34 +624,30 @@ private void toggleBroadcastStatusPanelVisibility()
* 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");
}
}

Expand Down
Expand Up @@ -161,10 +161,6 @@ public void logCurrentSettings()
{
mLog.info("SystemProperties - no properties file loaded - using defaults");
}
else
{
mLog.info("SystemProperties - application properties loaded [" + mPropertiesPath.toString() + "]");
}
}

/**
Expand Down

0 comments on commit a1a6b3e

Please sign in to comment.