From 06d914da5ac1e881fc4db3ad0546488d3b9324b3 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Thu, 11 Feb 2016 16:55:19 +0200 Subject: [PATCH] implemented for ios as well --- CrossPlatformModules.csproj | 3 ++- .../file-system-access-tests.ts | 11 +++++++++++ .../file-system-access-tests/folder/file.expected | 1 + file-system/file-system-access.ios.ts | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 apps/tests/file-system-access-tests/folder/file.expected diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index 32b55721c..760e382c0 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -2099,6 +2099,7 @@ PreserveNewest + @@ -2196,7 +2197,7 @@ False - + \ No newline at end of file diff --git a/apps/tests/file-system-access-tests/file-system-access-tests.ts b/apps/tests/file-system-access-tests/file-system-access-tests.ts index 3ef17f117..b9b318a3d 100644 --- a/apps/tests/file-system-access-tests/file-system-access-tests.ts +++ b/apps/tests/file-system-access-tests/file-system-access-tests.ts @@ -22,4 +22,15 @@ export var test_UTF8_BOM_is_not_returned = function () { TKUnit.assert(actualCharCode === expectedCharCode, "Actual character code: " + actualCharCode + "; Expected character code: " + expectedCharCode); } }; + +export var test_file_exists_on_folder = function () { + var path = fs.path.join(__dirname, "folder"); + + if (!fs.Folder.exists(path)) { + TKUnit.assert(false, `Could not read path ${path}`); + return; + } + + TKUnit.assertFalse(fs.File.exists(path), "File.exists() returned true for folder!"); +}; \ No newline at end of file diff --git a/apps/tests/file-system-access-tests/folder/file.expected b/apps/tests/file-system-access-tests/folder/file.expected new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/apps/tests/file-system-access-tests/folder/file.expected @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/file-system/file-system-access.ios.ts b/file-system/file-system-access.ios.ts index d7b4b9f3f..e7cd964a8 100644 --- a/file-system/file-system-access.ios.ts +++ b/file-system/file-system-access.ios.ts @@ -148,7 +148,7 @@ export class FileSystemAccess { public fileExists(path: string): boolean { var fileManager = NSFileManager.defaultManager(); - return fileManager.fileExistsAtPath(path); + return fileManager.fileExistsAtPath(path) && !this.folderExists(path); } public folderExists(path: string): boolean {