Skip to content

Commit 20a97a5

Browse files
committed
refactor(project): Normalize path separators in getVirtualPath on Windows
1 parent 4a58a19 commit 20a97a5

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/project/lib/specifications/types/Application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Application extends ComponentProject {
5252
getVirtualPath(sourceFilePath) {
5353
const sourcePath = this.getSourcePath();
5454
if (sourceFilePath.startsWith(sourcePath)) {
55-
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath);
55+
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath).replaceAll("\\", "/");
5656
return `/resources/${this._namespace}/${relSourceFilePath}`;
5757
}
5858

packages/project/lib/specifications/types/Library.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Library extends ComponentProject {
6767
getVirtualPath(sourceFilePath) {
6868
const sourcePath = this.getSourcePath();
6969
if (sourceFilePath.startsWith(sourcePath)) {
70-
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath);
70+
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath).replaceAll("\\", "/");
7171
let virBasePath = "/resources/";
7272
if (!this._isSourceNamespaced) {
7373
virBasePath += `${this._namespace}/`;
@@ -77,7 +77,7 @@ class Library extends ComponentProject {
7777

7878
const testPath = fsPath.join(this.getRootPath(), this._testPath);
7979
if (sourceFilePath.startsWith(testPath)) {
80-
const relSourceFilePath = fsPath.relative(testPath, sourceFilePath);
80+
const relSourceFilePath = fsPath.relative(testPath, sourceFilePath).replaceAll("\\", "/");
8181
let virBasePath = "/test-resources/";
8282
if (!this._isSourceNamespaced) {
8383
virBasePath += `${this._namespace}/`;

packages/project/lib/specifications/types/ThemeLibrary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ThemeLibrary extends Project {
4545
getVirtualPath(sourceFilePath) {
4646
const sourcePath = this.getSourcePath();
4747
if (sourceFilePath.startsWith(sourcePath)) {
48-
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath);
48+
const relSourceFilePath = fsPath.relative(sourcePath, sourceFilePath).replaceAll("\\", "/");
4949
return `/resources/${relSourceFilePath}`;
5050
}
5151

0 commit comments

Comments
 (0)