Skip to content

Commit ebac362

Browse files
author
Ramon Snir
authored
Merge pull request #4 from stackbit/export-posix-paths
Export POSIX paths
2 parents 638e708 + 6198f0a commit ebac362

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sourcebit-source-filesystem",
3-
"version": "0.1.6",
3+
"version": "0.2.0",
44
"description": "Sourcebit filesystem source plugin",
55
"main": "src/index.js",
66
"scripts": {

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)