Adds separatorChar and pathSeparatorChar fields to File ...

... and fixes a bug which caused path.separator to always return null.
This commit is contained in:
Simon Ochsenreither 2013-11-06 14:05:25 +01:00
parent da69b735f4
commit 5827c450c9
2 changed files with 8 additions and 0 deletions

View File

@ -653,6 +653,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
r = e->NewStringUTF("\r\n");
} else if (strcmp(chars, "file.separator") == 0) {
r = e->NewStringUTF("\\");
} else if (strcmp(chars, "path.separator") == 0) {
r = e->NewStringUTF(";");
} else if (strcmp(chars, "os.name") == 0) {
# if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
r = e->NewStringUTF("Windows");
@ -726,6 +728,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
r = e->NewStringUTF("\n");
} else if (strcmp(chars, "file.separator") == 0) {
r = e->NewStringUTF("/");
} else if (strcmp(chars, "path.separator") == 0) {
r = e->NewStringUTF(":");
} else if (strcmp(chars, "os.name") == 0) {
#ifdef __APPLE__
r = e->NewStringUTF("Mac OS X");

View File

@ -16,11 +16,15 @@ public class File implements Serializable {
public static final String separator = FileSeparator;
public static final char separatorChar = FileSeparator.charAt(0);
private static final String PathSeparator
= System.getProperty("path.separator");
public static final String pathSeparator = PathSeparator;
public static final char pathSeparatorChar = PathSeparator.charAt(0);
// static {
// System.loadLibrary("natives");
// }