diff --git a/build/commands/lib/pylint.js b/build/commands/lib/pylint.js index 463e2819070..148d29c8ad6 100644 --- a/build/commands/lib/pylint.js +++ b/build/commands/lib/pylint.js @@ -21,7 +21,8 @@ const deleteFile = (path) => { } const getDepotToolsPath = () => { - const depotToolsPath = path.resolve(__dirname, '../../../vendor/depot_tools') + const depotToolsPath = + path.join(config.rootDir, 'src/brave/vendor/depot_tools') if (!fs.existsSync(depotToolsPath)) { console.warn('Depot Tools path [' + depotToolsPath + '] doesn\'t exist') return '' @@ -48,7 +49,7 @@ const ensureDepotToolsInPath = (options) => { const getDefaultOptions = () => { let options = Object.assign({}, config.defaultOptions) - options.cwd = path.resolve(__dirname, '../../..') + options.cwd = path.join(config.rootDir, 'src/brave') ensureDepotToolsInPath(options) return options } diff --git a/build/commands/lib/root.js b/build/commands/lib/root.js index d93a85f10dd..6cd71ade473 100644 --- a/build/commands/lib/root.js +++ b/build/commands/lib/root.js @@ -1,3 +1,11 @@ const path = require('path') +const fs = require('fs') -module.exports = path.resolve(__dirname, '..', '..', '..', '..', '..') +let dirName = __dirname + +// Use fs.realpathSync to normalize the path(__dirname could be c:\.. or C:\..). +if (process.platform === 'win32') { + dirName = fs.realpathSync.native(dirName) +} + +module.exports = path.resolve(dirName, '..', '..', '..', '..', '..')