Skip to content
Permalink
Browse files

remove static String refs. to getUserFilesPath

  • Loading branch information...
icklesteve committed Aug 9, 2019
1 parent dfaf486 commit 4a5ff7a049b308a6176a0b68a98927e5711d8fb3
@@ -544,22 +544,14 @@ protected void storeEventsToXml() {
* Class to provide access to the EventTableData.xml file
*/
public static class CbusEventTableXmlFile extends XmlFile {
private static String fileLocation = FileUtil.getUserFilesPath() + "cbus" + File.separator; // NOI18N
private static String baseFileName = "EventTableData.xml"; // NOI18N

public static String getDefaultFileName() {
return getFileLocation() + getFileName();
}

public File getFile(boolean store) {
// Verify that directory:cbus exists
File chkdir = new File(getFileLocation());
if (!chkdir.exists()) {
if (!chkdir.mkdir()) {
log.error("Create directory:cbus failed"); // NOI18N
return null;
}
}
FileUtil.createDirectory(getFileLocation());

File file = findFile(getDefaultFileName());
if (file == null && store) {
@@ -570,10 +562,7 @@ public File getFile(boolean store) {
}

public static String getFileName() {
if(baseFileName == null) {
baseFileName = "EventTableData.xml"; // NOI18N
}
return baseFileName;
return "EventTableData.xml"; // NOI18N
}

/**
@@ -582,10 +571,7 @@ public static String getFileName() {
* @return path to location
*/
public static String getFileLocation() {
if(fileLocation==null){
fileLocation = FileUtil.getUserFilesPath() + "cbus" + File.separator; // NOI18N
}
return fileLocation;
return FileUtil.getUserFilesPath() + "cbus" + File.separator; // NOI18N
}
}

@@ -359,9 +359,6 @@ protected boolean removeNode( boolean rotate){

public static class CbusNodeBackupFile extends XmlFile {

private static String fileLocation = FileUtil.getUserFilesPath()
+ "cbus" + File.separator + "nodes" + File.separator; // NOI18N

public String getDefaultFileName(int nodeNum) {
return getFileLocation() + getFileName(nodeNum);
}
@@ -388,7 +385,8 @@ public String getFileName(int nodeNum) {
* @return path to location
*/
public static String getFileLocation() {
return fileLocation;
return FileUtil.getUserFilesPath()
+ "cbus" + File.separator + "nodes" + File.separator; // NOI18N
}

public boolean deleteFile(int nodeNum) {

0 comments on commit 4a5ff7a

Please sign in to comment.
You can’t perform that action at this time.