mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +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);
|
||||
}
|
||||
else if (action.equals("getMetadata")) {
|
||||
JSONObject obj = getMetadata(args.getString(0));
|
||||
return new PluginResult(status, obj);
|
||||
return new PluginResult(status, getMetadata(args.getString(0)));
|
||||
}
|
||||
else if (action.equals("getFileMetadata")) {
|
||||
JSONObject obj = getFileMetadata(args.getString(0));
|
||||
@ -764,21 +763,17 @@ public class FileUtils extends Plugin {
|
||||
* Look up metadata about this entry.
|
||||
*
|
||||
* @param filePath to entry
|
||||
* @return a Metadata object
|
||||
* @return a long
|
||||
* @throws FileNotFoundException
|
||||
* @throws JSONException
|
||||
*/
|
||||
private JSONObject getMetadata(String filePath) throws FileNotFoundException, JSONException {
|
||||
private long getMetadata(String filePath) throws FileNotFoundException {
|
||||
File file = createFileObject(filePath);
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException("Failed to find file in getMetadata");
|
||||
}
|
||||
|
||||
JSONObject metadata = new JSONObject();
|
||||
metadata.put("modificationTime", file.lastModified());
|
||||
|
||||
return metadata;
|
||||
return file.lastModified();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user