mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
file-name-resolver module
This commit is contained in:
29
apps/tests/pages/file-load-test.ts
Normal file
29
apps/tests/pages/file-load-test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import label = require("ui/label");
|
||||
import pages = require("ui/page");
|
||||
import fs = require("file-system");
|
||||
import fileResolverModule = require("file-system/file-name-resolver");
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var lbl = new label.Label();
|
||||
|
||||
var moduleName = "app/tests/pages/files/test";
|
||||
|
||||
var resolver = new fileResolverModule.FileNameResolver({
|
||||
width: 400,
|
||||
height: 600,
|
||||
os: "android",
|
||||
deviceType: "phone"
|
||||
});
|
||||
|
||||
// Current app full path.
|
||||
var currentAppPath = fs.knownFolders.currentApp().path;
|
||||
var moduleNamePath = fs.path.join(currentAppPath, moduleName);
|
||||
|
||||
var fileName = resolver.resolveFileName(moduleNamePath, "xml");
|
||||
lbl.text = fileName;
|
||||
lbl.textWrap = true;;
|
||||
|
||||
page.content = lbl;
|
||||
return page;
|
||||
}
|
||||
1
apps/tests/pages/files/other.xml
Normal file
1
apps/tests/pages/files/other.xml
Normal file
@@ -0,0 +1 @@
|
||||
other.xml
|
||||
1
apps/tests/pages/files/test.android.phone.xml
Normal file
1
apps/tests/pages/files/test.android.phone.xml
Normal file
@@ -0,0 +1 @@
|
||||
test.android.phone.xml
|
||||
1
apps/tests/pages/files/test.android.xml
Normal file
1
apps/tests/pages/files/test.android.xml
Normal file
@@ -0,0 +1 @@
|
||||
test.android.xml
|
||||
1
apps/tests/pages/files/test.minWH300.xml
Normal file
1
apps/tests/pages/files/test.minWH300.xml
Normal file
@@ -0,0 +1 @@
|
||||
test.minWH300.xml
|
||||
1
apps/tests/pages/files/test.minWH450.xml
Normal file
1
apps/tests/pages/files/test.minWH450.xml
Normal file
@@ -0,0 +1 @@
|
||||
test.monWH450.xml
|
||||
1
apps/tests/pages/files/test.xml
Normal file
1
apps/tests/pages/files/test.xml
Normal file
@@ -0,0 +1 @@
|
||||
test.xml
|
||||
Reference in New Issue
Block a user