Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 78305d6

Browse files
Vasil Chimevvchimev
Vasil Chimev
authored andcommitted
fix: resolve xml namespaces absolute paths on Windows
1 parent 75a7d83 commit 78305d6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: xml-namespace-loader.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { parse, relative, join, basename, extname } = require("path");
2+
const { convertSlashesInPath } = require("./projectHelpers");
23

3-
module.exports = function(source) {
4+
module.exports = function (source) {
45
this.value = source;
56

67
const { XmlParser } = require("tns-core-modules/xml");
@@ -47,7 +48,7 @@ module.exports = function(source) {
4748
namespaces.push({ name: namespace, path: resolvedPath });
4849
namespaces.push({ name: moduleName, path: resolvedPath });
4950

50-
const { dir, name } = parse(resolvedPath);
51+
const { dir, name } = parse(resolvedPath);
5152
const noExtFilename = join(dir, name);
5253

5354
const xml = tryResolve(`${noExtFilename}.xml`);
@@ -67,6 +68,11 @@ module.exports = function(source) {
6768
parser.parse(source);
6869

6970
const moduleRegisters = namespaces
71+
.map(function (n) {
72+
let obj = n;
73+
obj.path = convertSlashesInPath(n.path);
74+
return obj;
75+
})
7076
.map(n =>
7177
`global.registerModule("${n.name}", function() { return require("${n.path}"); });`
7278
)
@@ -86,9 +92,8 @@ module.exports = function(source) {
8692
function tryResolve(path) {
8793
try {
8894
return require.resolve(path);
89-
} catch(e) {
95+
} catch (e) {
9096
// The path couldn't be resolved
9197
return;
9298
}
9399
}
94-

0 commit comments

Comments
 (0)