mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 17:03:47 +01:00
fix: enhance path normalization for WSL compatibility in watcher (#3482)
This commit is contained in:
parent
23c22a96bc
commit
278ca8bf29
@ -2,7 +2,7 @@ const _ = require('lodash');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const chokidar = require('chokidar');
|
const chokidar = require('chokidar');
|
||||||
const { hasBruExtension } = require('../utils/filesystem');
|
const { hasBruExtension, isWSLPath, normalizeAndResolvePath, normalizeWslPath } = require('../utils/filesystem');
|
||||||
const { bruToEnvJson, bruToJson, collectionBruToJson } = require('../bru');
|
const { bruToEnvJson, bruToJson, collectionBruToJson } = require('../bru');
|
||||||
const { dotenvToJson } = require('@usebruno/lang');
|
const { dotenvToJson } = require('@usebruno/lang');
|
||||||
|
|
||||||
@ -445,11 +445,11 @@ class Watcher {
|
|||||||
ignoreInitial: false,
|
ignoreInitial: false,
|
||||||
usePolling: watchPath.startsWith('\\\\') || forcePolling ? true : false,
|
usePolling: watchPath.startsWith('\\\\') || forcePolling ? true : false,
|
||||||
ignored: (filepath) => {
|
ignored: (filepath) => {
|
||||||
const normalizedPath = filepath.replace(/\\/g, '/');
|
const normalizedPath = isWSLPath(filepath) ? normalizeWslPath(filepath) : normalizeAndResolvePath(filepath);
|
||||||
const relativePath = path.relative(watchPath, normalizedPath);
|
const relativePath = path.relative(watchPath, normalizedPath);
|
||||||
|
|
||||||
return ignores.some((ignorePattern) => {
|
return ignores.some((ignorePattern) => {
|
||||||
const normalizedIgnorePattern = ignorePattern.replace(/\\/g, '/');
|
const normalizedIgnorePattern = isWSLPath(ignorePattern) ? normalizeWslPath(ignorePattern) : ignorePattern.replace(/\\/g, '/');
|
||||||
return relativePath === normalizedIgnorePattern || relativePath.startsWith(normalizedIgnorePattern);
|
return relativePath === normalizedIgnorePattern || relativePath.startsWith(normalizedIgnorePattern);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user