Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions ImageJ/EPICS_areaDetector/EPICS_NTNDA_Viewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -829,17 +832,22 @@ private void logMessage(String message, boolean logDisplay, boolean logFile)

private void readProperties()
{
String temp, path = null;
String temp = null;
Path path = Paths.get(System.getProperty("user.home"), ".config");
try
{
String fileSep = System.getProperty("file.separator");
path = System.getProperty("user.home") + fileSep + propertyFile;
FileInputStream file = new FileInputStream(path);
// If the .config directory does not exist, move back up to the home dir
if (!Files.exists(path)){
path = path.getParent();
}
path = Paths.get(path.toString(), propertyFile);

FileInputStream file = new FileInputStream(path.toString());
properties.load(file);
file.close();
temp = properties.getProperty("channelName");
if (temp != null) channelName = temp;
IJ.log("Read properties file: " + path + " channelName= " + channelName);
IJ.log("Read properties file: " + path.toString() + " channelName= " + channelName);
}
catch (Exception ex)
{
Expand All @@ -849,16 +857,20 @@ private void readProperties()

private void writeProperties()
{
String path;
Path path = Paths.get(System.getProperty("user.home"), ".config");
try
{
String fileSep = System.getProperty("file.separator");
path = System.getProperty("user.home") + fileSep + propertyFile;
// If the .config directory does not exist, move back up to the home dir
if (!Files.exists(path)){
path = path.getParent();
}
path = Paths.get(path.toString(), propertyFile);

properties.setProperty("channelName", channelName);
FileOutputStream file = new FileOutputStream(path);
FileOutputStream file = new FileOutputStream(path.toString());
properties.store(file, "EPICS_NTNDA_Viewer Properties");
file.close();
logMessage("Wrote properties file: " + path, true, true);
logMessage("Wrote properties file: " + path.toString(), true, true);
}
catch (Exception ex)
{
Expand Down