Rename data directory from Google/Refine to OpenRefine - closed #777
This commit is contained in:
parent
fa072df85c
commit
d5873c5803
@ -11,3 +11,4 @@ REFINE_MEMORY=1400M
|
|||||||
#ANT_HOME=C:\grefine\tools\apache-ant-1.8.1
|
#ANT_HOME=C:\grefine\tools\apache-ant-1.8.1
|
||||||
#JAVA_HOME=C:\Program Files\Java\jdk1.6.0_25
|
#JAVA_HOME=C:\Program Files\Java\jdk1.6.0_25
|
||||||
#JAVA_OPTIONS=-XX:+UseParallelGC -verbose:gc -Drefine.headless=true
|
#JAVA_OPTIONS=-XX:+UseParallelGC -verbose:gc -Drefine.headless=true
|
||||||
|
#JAVA_OPTIONS=-Drefine.data_dir=C:\Users\user\AppData\Roaming\OpenRefine
|
||||||
|
@ -309,6 +309,7 @@ class RefineServer extends Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
File dataDir = null;
|
File dataDir = null;
|
||||||
|
File grefineDir = null;
|
||||||
File gridworksDir = null;
|
File gridworksDir = null;
|
||||||
|
|
||||||
String os = System.getProperty("os.name").toLowerCase();
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
@ -319,10 +320,13 @@ class RefineServer extends Server {
|
|||||||
// so we're using a library that uses JNI to ask directly the win32 APIs,
|
// 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.
|
// 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");
|
DataPath localDataPath = JDataPathSystem.getLocalSystem().getLocalDataPath("Google");
|
||||||
|
|
||||||
// new: ./Google/Refine old: ./Gridworks
|
// new: ./Google/Refine old: ./Gridworks
|
||||||
dataDir = new File(new File(fixWindowsUnicodePath(localDataPath.getPath())), "Refine");
|
grefineDir = new File(new File(fixWindowsUnicodePath(localDataPath.getPath())), "Refine");
|
||||||
gridworksDir = new File(fixWindowsUnicodePath(JDataPathSystem.getLocalSystem()
|
gridworksDir = new File(fixWindowsUnicodePath(JDataPathSystem.getLocalSystem()
|
||||||
.getLocalDataPath("Gridworks").getPath()));
|
.getLocalDataPath("Gridworks").getPath()));
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
@ -351,17 +355,20 @@ class RefineServer extends Server {
|
|||||||
parentDir = new File(".");
|
parentDir = new File(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
dataDir = new File(new File(parentDir, "Google"), "Refine");
|
dataDir = new File(parentDir, "OpenRefine");
|
||||||
|
grefineDir = new File(new File(parentDir, "Google"), "Refine");
|
||||||
gridworksDir = new File(parentDir, "Gridworks");
|
gridworksDir = new File(parentDir, "Gridworks");
|
||||||
}
|
}
|
||||||
} else if (os.contains("mac os x")) {
|
} else if (os.contains("mac os x")) {
|
||||||
// on macosx, use "~/Library/Application Support"
|
// on macosx, use "~/Library/Application Support"
|
||||||
String home = System.getProperty("user.home");
|
String home = System.getProperty("user.home");
|
||||||
|
|
||||||
// TODO: Update needed (again)
|
String data_home = (home != null) ? home + "/Library/Application Support/OpenRefine" : ".openrefine";
|
||||||
String data_home = (home != null) ? home + "/Library/Application Support/Google/Refine" : ".google-refine";
|
|
||||||
dataDir = new File(data_home);
|
dataDir = new File(data_home);
|
||||||
|
|
||||||
|
String grefine_home = (home != null) ? home + "/Library/Application Support/Google/Refine" : ".google-refine";
|
||||||
|
grefineDir = new File(grefine_home);
|
||||||
|
|
||||||
String gridworks_home = (home != null) ? home + "/Library/Application Support/Gridworks" : ".gridworks";
|
String gridworks_home = (home != null) ? home + "/Library/Application Support/Gridworks" : ".gridworks";
|
||||||
gridworksDir = new File(gridworks_home);
|
gridworksDir = new File(gridworks_home);
|
||||||
} else { // most likely a UNIX flavor
|
} else { // most likely a UNIX flavor
|
||||||
@ -376,16 +383,27 @@ class RefineServer extends Server {
|
|||||||
data_home = home + "/.local/share";
|
data_home = home + "/.local/share";
|
||||||
}
|
}
|
||||||
|
|
||||||
dataDir = new File(data_home + "/google/refine");
|
dataDir = new File(data_home + "/openrefine");
|
||||||
|
grefineDir = new File(data_home + "/google/refine");
|
||||||
gridworksDir = new File(data_home + "/gridworks");
|
gridworksDir = new File(data_home + "/gridworks");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If refine data dir doesn't exist, try to find and move gridworks data dir over
|
// If refine data dir doesn't exist, try to find and move Google Refine or Gridworks data dir over
|
||||||
if (!dataDir.exists() && gridworksDir.exists()) {
|
if (!dataDir.exists()) {
|
||||||
if (!dataDir.getParentFile().mkdirs()) {
|
if (grefineDir.exists()) {
|
||||||
logger.error("FAILED to create parent directory for workspace rename target "
|
if (gridworksDir.exists()) {
|
||||||
+ dataDir.getParent());
|
logger.warn("Found both Gridworks: " + gridworksDir
|
||||||
} else {
|
+ " & Googld Refine dirs " + grefineDir) ;
|
||||||
|
}
|
||||||
|
if (grefineDir.renameTo(dataDir)) {
|
||||||
|
logger.info("Renamed Google Refine directory " + grefineDir
|
||||||
|
+ " to " + dataDir);
|
||||||
|
} else {
|
||||||
|
logger.error("FAILED to rename Google Refine directory "
|
||||||
|
+ grefineDir
|
||||||
|
+ " to " + dataDir);
|
||||||
|
}
|
||||||
|
} else if (gridworksDir.exists()) {
|
||||||
if (gridworksDir.renameTo(dataDir)) {
|
if (gridworksDir.renameTo(dataDir)) {
|
||||||
logger.info("Renamed Gridworks directory " + gridworksDir
|
logger.info("Renamed Gridworks directory " + gridworksDir
|
||||||
+ " to " + dataDir);
|
+ " to " + dataDir);
|
||||||
|
Loading…
Reference in New Issue
Block a user