1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

fix stat times not being set

This commit is contained in:
Mathias Buus 2020-01-07 10:44:38 +01:00
parent 0a17689a51
commit 148f2af59d

View File

@ -689,6 +689,12 @@ function getDoubleInt (arr, idx) {
return num
}
function toDateMS (st) {
if (typeof st === 'number') return st
if (!st) return Date.now()
return st.getTime()
}
function getStatArray (stat) {
const ints = new Uint32Array(16)
@ -702,9 +708,9 @@ function getStatArray (stat) {
ints[7] = (stat && stat.rdev) || 0
ints[8] = (stat && stat.blksize) || 0
ints[9] = (stat && stat.blocks) || 0
setDoubleInt(ints, 10, (stat && stat.atim) || Date.now())
setDoubleInt(ints, 12, (stat && stat.atim) || Date.now())
setDoubleInt(ints, 14, (stat && stat.atim) || Date.now())
setDoubleInt(ints, 10, toDateMS(stat && stat.atime))
setDoubleInt(ints, 12, toDateMS(stat && stat.ctime))
setDoubleInt(ints, 14, toDateMS(stat && stat.mtime))
return ints
}