Skip to content

Commit 4a6aa29

Browse files
committed
fix(gcc): handle win32 paths for defines and options
1 parent b078fa4 commit 4a6aa29

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

plugins/gcc/defines.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const Promise = require('bluebird');
44
const fs = Promise.promisifyAll(require('fs'));
55
const path = require('path');
66
const utils = require('../../utils');
7+
const slash = require('slash');
78

89
/**
910
* @fileOverview
@@ -55,7 +56,7 @@ const resolver = function(pack, projectDir, depth) {
5556
var value = pack.build.moduleDefines[key];
5657
var modulePath = utils.resolveModulePath(value, projectDir);
5758
if (modulePath) {
58-
modules[key] = path.relative(projectDir, modulePath);
59+
modules[key] = slash(path.relative(projectDir, modulePath));
5960
} else {
6061
throw new Error('Unable to resolve module path for define ' + key + ' with path ' + value + '.');
6162
}
@@ -72,7 +73,7 @@ const resolver = function(pack, projectDir, depth) {
7273
var origPath = results[2].replace(/[\\/]+$/, '');
7374
var definePath = path.normalize(path.join(relPath, origPath));
7475

75-
defines[results[1]] = definePath + path.sep;
76+
defines[results[1]] = slash(definePath + path.sep);
7677
}
7778

7879
regex.lastIndex = 0;

plugins/gcc/options.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const path = require('path');
33
const utils = require('../../utils');
4+
const slash = require('slash');
45

56
var basePackage = null;
67
var definesFound = {};
@@ -42,7 +43,7 @@ const resolver = function(pack, projectDir, depth) {
4243

4344
// resolve the path from the project directory if not found in node_modules
4445
return (exclusion ? '!' : '') +
45-
utils.flattenPath(path.resolve(projectDir, item));
46+
slash(utils.flattenPath(path.resolve(projectDir, item)));
4647
};
4748

4849
for (var key in options) {

0 commit comments

Comments
 (0)