diff --git a/server/pom.xml b/server/pom.xml index 9ea3737bf..2ae21d455 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -172,11 +172,6 @@ jetty-webapp ${jetty.version} - - org.openrefine.dependencies - jdatapath - alpha2 - org.openrefine.dependencies butterfly diff --git a/server/src/com/google/refine/Refine.java b/server/src/com/google/refine/Refine.java index 0a524055d..93b9fbd38 100644 --- a/server/src/com/google/refine/Refine.java +++ b/server/src/com/google/refine/Refine.java @@ -64,9 +64,6 @@ import com.google.util.threads.ThreadPoolExecutorAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.codeberry.jdatapath.DataPath; -import com.codeberry.jdatapath.JDataPathSystem; - import com.google.refine.Configurations; /** @@ -356,51 +353,27 @@ class RefineServer extends Server { String os = System.getProperty("os.name").toLowerCase(); if (os.contains("windows")) { - try { - // NOTE(SM): finding the "local data app" in windows from java is actually a PITA - // see http://stackoverflow.com/questions/1198911/how-to-get-local-application-data-folder-in-java - // so we're using a library that uses JNI to ask directly the win32 APIs, - // it's not elegant but it's the safest bet. - - dataDir = new File(fixWindowsUnicodePath(JDataPathSystem.getLocalSystem() - .getLocalDataPath("OpenRefine").getPath())); - - DataPath localDataPath = JDataPathSystem.getLocalSystem().getLocalDataPath("Google"); - - // new: ./Google/Refine old: ./Gridworks - grefineDir = new File(new File(fixWindowsUnicodePath(localDataPath.getPath())), "Refine"); - gridworksDir = new File(fixWindowsUnicodePath(JDataPathSystem.getLocalSystem() - .getLocalDataPath("Gridworks").getPath())); - } catch (Error e) { - /* - * The above trick can fail, particularly on a 64-bit OS as the jdatapath.dll - * we include is compiled for 32-bit. In this case, we just have to dig up - * environment variables and try our best to find a user-specific path. - */ - - logger.warn("Failed to use jdatapath to detect user data path: resorting to environment variables"); - - File parentDir = null; - String appData = System.getenv("APPDATA"); - if (appData != null && appData.length() > 0) { - // e.g., C:\Users\[userid]\AppData\Roaming - parentDir = new File(appData); - } else { - String userProfile = System.getenv("USERPROFILE"); - if (userProfile != null && userProfile.length() > 0) { - // e.g., C:\Users\[userid] - parentDir = new File(userProfile); - } + File parentDir = null; + String appData = System.getenv("APPDATA"); + if (appData != null && appData.length() > 0) { + // e.g., C:\Users\[userid]\AppData\Roaming + parentDir = new File(appData); + } else { + // TODO migrate to System.getProperty("user.home")? + String userProfile = System.getProperty("user.home"); + if (userProfile != null && userProfile.length() > 0) { + // e.g., C:\Users\[userid] + parentDir = new File(userProfile); } - - if (parentDir == null) { - parentDir = new File("."); - } - - dataDir = new File(parentDir, "OpenRefine"); - grefineDir = new File(new File(parentDir, "Google"), "Refine"); - gridworksDir = new File(parentDir, "Gridworks"); } + + if (parentDir == null) { + parentDir = new File("."); + } + + dataDir = new File(parentDir, "OpenRefine"); + grefineDir = new File(new File(parentDir, "Google"), "Refine"); + gridworksDir = new File(parentDir, "Gridworks"); } else if (os.contains("os x")) { // on macosx, use "~/Library/Application Support" String home = System.getProperty("user.home");