Commit 525a2b86 by Jason Song

add spport for windows local cache dir

parent ee7148f1
...@@ -185,8 +185,8 @@ public class ConfigUtil { ...@@ -185,8 +185,8 @@ public class ConfigUtil {
} }
public String getDefaultLocalCacheDir() { public String getDefaultLocalCacheDir() {
//TODO call Framework Foundation to get the default local cache dir String cacheRoot = isOSWindows() ? "C:\\opt\\data\\%s" : "/opt/data/%s";
return String.format("/opt/data/%s", getAppId()); return String.format(cacheRoot, getAppId());
} }
public boolean isInLocalMode() { public boolean isInLocalMode() {
...@@ -198,4 +198,12 @@ public class ConfigUtil { ...@@ -198,4 +198,12 @@ public class ConfigUtil {
} }
return false; return false;
} }
public boolean isOSWindows() {
String osName = System.getProperty("os.name");
if (Strings.isNullOrEmpty(osName)) {
return false;
}
return osName.startsWith("Windows");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment