Skip to content
Snippets Groups Projects
Commit f5a15a39 authored by Mark Winter's avatar Mark Winter
Browse files

Added getUserHome function into PlatformInfo

parent 640a73e7
Branches
No related tags found
No related merge requests found
......@@ -89,7 +89,7 @@ public class LeverscIJ implements PlugInFilter
Metadata meta = load_metadata();
if ( !init_leversc(fignum) )
{
Path logpath = Paths.get(System.getProperty("user.home"),".lever");
Path logpath = Paths.get(PlatformInfo.getUserHome(),".lever");
IJ.log("Unable to initialize leversc!");
IJ.log(String.format("Check leversc log files for details at: %s", logpath.toString()));
......
......@@ -72,7 +72,7 @@ public class LeverscLaunch
public static boolean launch(File localLeverscExec, int fignum, int base_port)
{
// Always put .lever files in ~/.lever folder
Path cwd_lever = Paths.get(System.getProperty("user.home"),".lever");
Path cwd_lever = Paths.get(PlatformInfo.getUserHome(),".lever");
// Make sure ~/.lever folder exists
try
......@@ -156,8 +156,8 @@ public class LeverscLaunch
p = Runtime.getRuntime().exec(strArgs);
if ( p!= null )
{
File stdoutLog = Paths.get(System.getProperty("user.home"),".lever", "leversc_out.log").toFile();
File stderrLog = Paths.get(System.getProperty("user.home"),".lever", "leversc_err.log").toFile();
File stdoutLog = Paths.get(PlatformInfo.getUserHome(),".lever", "leversc_out.log").toFile();
File stderrLog = Paths.get(PlatformInfo.getUserHome(),".lever", "leversc_err.log").toFile();
LogThread stdoutLogger = new LogThread(p.getInputStream(), stdoutLog);
LogThread stderrLogger = new LogThread(p.getErrorStream(), stderrLog);
......
......@@ -20,6 +20,11 @@ public class PlatformInfo
return "unknown";
}
public static String getUserHome()
{
return System.getProperty("user.home");
}
public static String getAppDataPath()
{
......@@ -29,15 +34,15 @@ public class PlatformInfo
{
String xdg_home = System.getenv("XDG_DATA_HOME");
if ( xdg_home == null )
xdg_home = Paths.get(System.getProperty("user.home"), ".local", "share").toString();
xdg_home = Paths.get(getUserHome(), ".local", "share").toString();
return xdg_home;
}
else if ( isMac() )
{
return Paths.get(System.getProperty("user.home"), "Applications").toString();
return Paths.get(getUserHome(), "Applications").toString();
}
else
return System.getProperty("user.home");
return getUserHome();
}
public static boolean isWindows()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment