Skip to content

Commit a251212

Browse files
committed
convert exported paths to POSIX format
1 parent 638e708 commit a251212

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ async function readFiles(sources) {
149149
const data = await parseFile(absFilePath);
150150
result.push(_.assign({
151151
__metadata: {
152-
id: `${relProjectPath}`,
152+
id: `${convertPathToPosix(relProjectPath)}`,
153153
source: SOURCE,
154154
sourceName: name,
155-
sourcePath: sourcePath,
156-
relSourcePath: relSourcePath,
157-
relProjectPath: relProjectPath
155+
sourcePath: convertPathToPosix(sourcePath),
156+
relSourcePath: convertPathToPosix(relSourcePath),
157+
relProjectPath: convertPathToPosix(relProjectPath)
158158
}
159159
}, data));
160160
} catch (error) {
@@ -165,3 +165,13 @@ async function readFiles(sources) {
165165
});
166166
return _.chain(result).flatten().value();
167167
}
168+
169+
function convertPathToPosix(p) {
170+
if (path.sep === path.posix.sep) {
171+
return p;
172+
}
173+
if (!p) {
174+
return p;
175+
}
176+
return p.split(path.sep).join(path.posix.sep);
177+
}

0 commit comments

Comments
 (0)