Skip to content

Commit

Permalink
Merge pull request #339 from zhantx/master
Browse files Browse the repository at this point in the history
fix touch() error on android
  • Loading branch information
itinance authored Sep 1, 2017
2 parents 2ccf129 + 487e519 commit a23a703
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FS.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var NativeAppEventEmitter = require('react-native').NativeAppEventEmitter; // i
var DeviceEventEmitter = require('react-native').DeviceEventEmitter; // Android
var base64 = require('base-64');
var utf8 = require('utf8');
var isIOS = require('react-native').Platform.OS === 'ios';

var RNFSFileTypeRegular = RNFSManager.RNFSFileTypeRegular;
var RNFSFileTypeDirectory = RNFSManager.RNFSFileTypeDirectory;
Expand Down Expand Up @@ -503,10 +504,14 @@ var RNFS = {
touch(filepath: string, mtime?: Date, ctime?: Date): Promise<void> {
if (ctime && !(ctime instanceof Date)) throw new Error('touch: Invalid value for argument `ctime`');
if (mtime && !(mtime instanceof Date)) throw new Error('touch: Invalid value for argument `mtime`');
var ctimeTime = 0;
if (isIOS) {
ctimeTime = ctime && ctime.getTime();
}
return RNFSManager.touch(
normalizeFilePath(filepath),
mtime && mtime.getTime(),
ctime && ctime.getTime()
ctimeTime
);
},

Expand Down

0 comments on commit a23a703

Please sign in to comment.