Skip to content

Commit

Permalink
Only check Linux home.dir for property file, default to a hidden file…
Browse files Browse the repository at this point in the history
… if no file is found. Closes #288
  • Loading branch information
winder committed Feb 20, 2016
1 parent 089b113 commit dc1c1d6
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/com/willwinder/universalgcodesender/utils/SettingsFactory.java
Expand Up @@ -62,24 +62,12 @@ else if (System.getProperty("os.name").toLowerCase().contains("windows")) {
else {
properties = new File(homeDir + propertiesFilename);

// Check homedir hidden/not hidden
// Check homedir for hidden / not hidden files
json = new File(homeDir + "/" + jsonFilename);
if (!json.exists()) {
// Default to hidden if none.
json = new File(homeDir + "/." + jsonFilename);
}
// Check /etc
if (!json.exists()) {
json = new File("/etc/" + jsonFilename);
}
// Check /usr/share
if (!json.exists()) {
json = new File("/usr/share/UniversalGcodeSender/" + jsonFilename);
}

// No file.
if (!json.exists()) {
json = new File(homeDir + "/" + jsonFilename);
}
}

return properties.exists() ? properties : json;
Expand Down

0 comments on commit dc1c1d6

Please sign in to comment.