mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
CB-438: File metadata.modificationTime returns an invalid date
This commit is contained in:
parent
e213772f98
commit
04aa6d3c38
@ -142,8 +142,7 @@ public class FileUtils extends Plugin {
|
|||||||
return new PluginResult(status, obj);
|
return new PluginResult(status, obj);
|
||||||
}
|
}
|
||||||
else if (action.equals("getMetadata")) {
|
else if (action.equals("getMetadata")) {
|
||||||
JSONObject obj = getMetadata(args.getString(0));
|
return new PluginResult(status, getMetadata(args.getString(0)));
|
||||||
return new PluginResult(status, obj);
|
|
||||||
}
|
}
|
||||||
else if (action.equals("getFileMetadata")) {
|
else if (action.equals("getFileMetadata")) {
|
||||||
JSONObject obj = getFileMetadata(args.getString(0));
|
JSONObject obj = getFileMetadata(args.getString(0));
|
||||||
@ -764,21 +763,17 @@ public class FileUtils extends Plugin {
|
|||||||
* Look up metadata about this entry.
|
* Look up metadata about this entry.
|
||||||
*
|
*
|
||||||
* @param filePath to entry
|
* @param filePath to entry
|
||||||
* @return a Metadata object
|
* @return a long
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
* @throws JSONException
|
|
||||||
*/
|
*/
|
||||||
private JSONObject getMetadata(String filePath) throws FileNotFoundException, JSONException {
|
private long getMetadata(String filePath) throws FileNotFoundException {
|
||||||
File file = createFileObject(filePath);
|
File file = createFileObject(filePath);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
throw new FileNotFoundException("Failed to find file in getMetadata");
|
throw new FileNotFoundException("Failed to find file in getMetadata");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject metadata = new JSONObject();
|
return file.lastModified();
|
||||||
metadata.put("modificationTime", file.lastModified());
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user