mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(file-system-access): join paths without leading slash
This commit is contained in:
@ -33,3 +33,11 @@ export var test_file_exists_on_folder = function () {
|
|||||||
|
|
||||||
TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!");
|
TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
@ -428,7 +428,7 @@ export class FileSystemAccess {
|
|||||||
var file1 = new java.io.File(left);
|
var file1 = new java.io.File(left);
|
||||||
var file2 = new java.io.File(file1, right);
|
var file2 = new java.io.File(file1, right);
|
||||||
|
|
||||||
return file2.getAbsolutePath();
|
return file2.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public joinPaths(paths: string[]): string {
|
public joinPaths(paths: string[]): string {
|
||||||
@ -446,6 +446,6 @@ export class FileSystemAccess {
|
|||||||
result = this.joinPath(result, paths[i]);
|
result = this.joinPath(result, paths[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.normalizePath(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user