diff --git a/apps/tests/file-system-tests.ts b/apps/tests/file-system-tests.ts index cb1743892..59d46b6a7 100644 --- a/apps/tests/file-system-tests.ts +++ b/apps/tests/file-system-tests.ts @@ -579,3 +579,16 @@ export function testKnownFolderRemove(done) { done(null); }); }; + +export function test_FSEntity_Properties() { + var documents = fs.knownFolders.documents(); + var file = documents.getFile("Test_File.txt"); + + TKUnit.assert(file.extension === ".txt", "FileEntity.extension not working."); + TKUnit.assert(file.isLocked === false, "FileEntity.isLocked not working."); + TKUnit.assert(file.lastModified instanceof Date, "FileEntity.lastModified not working."); + TKUnit.assert(file.name === "Test_File.txt", "FileEntity.name not working."); + TKUnit.assert(file.parent === documents, "FileEntity.parent not working."); + + file.remove(); +} diff --git a/file-system/file-system-access.ios.ts b/file-system/file-system-access.ios.ts index 975fb0620..c14c7c729 100644 --- a/file-system/file-system-access.ios.ts +++ b/file-system/file-system-access.ios.ts @@ -18,11 +18,7 @@ export class FileSystemAccess { var attributes = fileManager.attributesOfItemAtPathError(path, null); if (attributes) { - var date = attributes.objectForKey(this.keyModificationTime); - var interval = date.timeIntervalSince1970(); - - // time interval is in seconds, Date constructor expects milliseconds, hence this multiply by 1000 - return new Date(interval * 1000); + return attributes.objectForKey(this.keyModificationTime); } else { return new Date(); } diff --git a/file-system/file-system.ts b/file-system/file-system.ts index 73d240b28..99f2826bf 100644 --- a/file-system/file-system.ts +++ b/file-system/file-system.ts @@ -159,7 +159,8 @@ export class File extends FileSystemEntity { } get isLocked(): boolean { - return this[fileLockedProperty]; + // !! is a boolean conversion/cast, handling undefined as well + return !!this[fileLockedProperty]; } public readText(encoding?: string): Promise {