mirror of
https://github.com/corda/corda.git
synced 2025-01-19 19:26:27 +00:00
Add last modified to file
This commit is contained in:
parent
dca12d3cd0
commit
2d11e7ccd4
@ -541,6 +541,28 @@ Java_java_io_File_openDir(JNIEnv* e, jclass, jstring path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
Java_java_io_File_lastModified(JNIEnv* e, jclass, jstring path)
|
||||||
|
{
|
||||||
|
string_t chars = getChars(e, path);
|
||||||
|
if (chars) {
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
# error "Implementation of last modified :)"
|
||||||
|
#else
|
||||||
|
struct stat st;
|
||||||
|
if (stat(chars, &st)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return (static_cast<jlong>(st.st_mtim.tv_sec) * 1000) +
|
||||||
|
(static_cast<jlong>(st.st_mtim.tv_nsec) / (1000*1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
Java_java_io_File_readDir(JNIEnv* e, jclass, jlong handle)
|
Java_java_io_File_readDir(JNIEnv* e, jclass, jlong handle)
|
||||||
{
|
{
|
||||||
|
@ -294,12 +294,19 @@ public class File implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long lastModified() {
|
||||||
|
return lastModified(path);
|
||||||
|
}
|
||||||
private static native long openDir(String path);
|
private static native long openDir(String path);
|
||||||
|
|
||||||
|
private static native long lastModified(String path);
|
||||||
|
|
||||||
private static native String readDir(long handle);
|
private static native String readDir(long handle);
|
||||||
|
|
||||||
private static native long closeDir(long handle);
|
private static native long closeDir(long handle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static class Pair {
|
private static class Pair {
|
||||||
public final String value;
|
public final String value;
|
||||||
public final Pair next;
|
public final Pair next;
|
||||||
|
Loading…
Reference in New Issue
Block a user