diff --git a/tests/app/file-system-access-tests/file-system-access-tests.ts b/tests/app/file-system-access-tests/file-system-access-tests.ts index 44d01e556..077be87a8 100644 --- a/tests/app/file-system-access-tests/file-system-access-tests.ts +++ b/tests/app/file-system-access-tests/file-system-access-tests.ts @@ -32,4 +32,12 @@ export var test_file_exists_on_folder = function () { } TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!"); -}; \ No newline at end of file +}; + +export var test_leading_slash_is_not_returned = function () { + var parts = ["app", "tns_modules", "fileName"]; + var expected = parts.join("/"); + var path = fs.path.join(...parts); + + TKUnit.assertEqual(path, expected, "Leading slash should not be part of the path"); +} \ No newline at end of file diff --git a/tns-core-modules/file-system/file-system-access.android.ts b/tns-core-modules/file-system/file-system-access.android.ts index a336eeb6b..c5b5fc802 100644 --- a/tns-core-modules/file-system/file-system-access.android.ts +++ b/tns-core-modules/file-system/file-system-access.android.ts @@ -192,7 +192,7 @@ export class FileSystemAccess { var dir = utils.ad.getApplicationContext().getCacheDir(); return dir.getAbsolutePath(); } - + public getCurrentAppPath(): string { return this.getLogicalRootPath() + "/app"; } @@ -428,7 +428,7 @@ export class FileSystemAccess { var file1 = new java.io.File(left); var file2 = new java.io.File(file1, right); - return file2.getAbsolutePath(); + return file2.getPath(); } public joinPaths(paths: string[]): string { @@ -446,6 +446,6 @@ export class FileSystemAccess { result = this.joinPath(result, paths[i]); } - return this.normalizePath(result); + return result; } } \ No newline at end of file