Skip to content

Commit 06d914d

Browse files
author
Vladimir Enchev
committed
implemented for ios as well
1 parent 5c1639b commit 06d914d

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

CrossPlatformModules.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,7 @@
20992099
<Content Include="apps\custom-root-view\package.json">
21002100
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
21012101
</Content>
2102+
<Content Include="apps\tests\file-system-access-tests\folder\file.expected" />
21022103
<None Include="js-libs\esprima\LICENSE.BSD" />
21032104
<Content Include="source-control.md" />
21042105
<Content Include="ui\segmented-bar\package.json">
@@ -2196,7 +2197,7 @@
21962197
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
21972198
</WebProjectProperties>
21982199
</FlavorProperties>
2199-
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
2200+
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
22002201
</VisualStudio>
22012202
</ProjectExtensions>
22022203
</Project>

apps/tests/file-system-access-tests/file-system-access-tests.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ export var test_UTF8_BOM_is_not_returned = function () {
2222
TKUnit.assert(actualCharCode === expectedCharCode, "Actual character code: " + actualCharCode + "; Expected character code: " + expectedCharCode);
2323
}
2424
};
25+
26+
export var test_file_exists_on_folder = function () {
27+
var path = fs.path.join(__dirname, "folder");
28+
29+
if (!fs.Folder.exists(path)) {
30+
TKUnit.assert(false, `Could not read path ${path}`);
31+
return;
32+
}
33+
34+
TKUnit.assertFalse(fs.File.exists(path), "File.exists() returned true for folder!");
35+
};
2536

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


file-system/file-system-access.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class FileSystemAccess {
148148

149149
public fileExists(path: string): boolean {
150150
var fileManager = NSFileManager.defaultManager();
151-
return fileManager.fileExistsAtPath(path);
151+
return fileManager.fileExistsAtPath(path) && !this.folderExists(path);
152152
}
153153

154154
public folderExists(path: string): boolean {

0 commit comments

Comments
 (0)