FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(file-system-access): join paths without leading slash · NativeScript/NativeScript@1a497b1 · GitHub

Commit 1a497b1

Browse files
committed
fix(file-system-access): join paths without leading slash
1 parent 414ebc6 commit 1a497b1

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎tests/app/file-system-access-tests/file-system-access-tests.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,12 @@ export var test_file_exists_on_folder = function () {
3232
}
3333

3434
TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!");
35-
};
35+
};
36+
37+
export var test_leading_slash_is_not_returned = function () {
38+
var parts = ["app", "tns_modules", "fileName"];
39+
var expected = parts.join("/");
40+
var path = fs.path.join(...parts);
41+
42+
TKUnit.assertEqual(path, expected, "Leading slash should not be part of the path");
43+
}

‎tns-core-modules/file-system/file-system-access.android.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class FileSystemAccess {
192192
var dir = utils.ad.getApplicationContext().getCacheDir();
193193
return dir.getAbsolutePath();
194194
}
195-
195+
196196
public getCurrentAppPath(): string {
197197
return this.getLogicalRootPath() + "/app";
198198
}
@@ -428,7 +428,7 @@ export class FileSystemAccess {
428428
var file1 = new java.io.File(left);
429429
var file2 = new java.io.File(file1, right);
430430

431-
return file2.getAbsolutePath();
431+
return file2.getPath();
432432
}
433433

434434
public joinPaths(paths: string[]): string {
@@ -446,6 +446,6 @@ export class FileSystemAccess {
446446
result = this.joinPath(result, paths[i]);
447447
}
448448

449-
return this.normalizePath(result);
449+
return result;
450450
}
451451
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL