From 278ca8bf2977f2bcaf4c22ac5aa3f00bf50e743c Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:02:06 +0530 Subject: [PATCH] fix: enhance path normalization for WSL compatibility in watcher (#3482) --- packages/bruno-electron/src/app/watcher.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bruno-electron/src/app/watcher.js b/packages/bruno-electron/src/app/watcher.js index 82d116d81..a26ff5d53 100644 --- a/packages/bruno-electron/src/app/watcher.js +++ b/packages/bruno-electron/src/app/watcher.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const fs = require('fs'); const path = require('path'); const chokidar = require('chokidar'); -const { hasBruExtension } = require('../utils/filesystem'); +const { hasBruExtension, isWSLPath, normalizeAndResolvePath, normalizeWslPath } = require('../utils/filesystem'); const { bruToEnvJson, bruToJson, collectionBruToJson } = require('../bru'); const { dotenvToJson } = require('@usebruno/lang'); @@ -445,11 +445,11 @@ class Watcher { ignoreInitial: false, usePolling: watchPath.startsWith('\\\\') || forcePolling ? true : false, ignored: (filepath) => { - const normalizedPath = filepath.replace(/\\/g, '/'); + const normalizedPath = isWSLPath(filepath) ? normalizeWslPath(filepath) : normalizeAndResolvePath(filepath); const relativePath = path.relative(watchPath, normalizedPath); return ignores.some((ignorePattern) => { - const normalizedIgnorePattern = ignorePattern.replace(/\\/g, '/'); + const normalizedIgnorePattern = isWSLPath(ignorePattern) ? normalizeWslPath(ignorePattern) : ignorePattern.replace(/\\/g, '/'); return relativePath === normalizedIgnorePattern || relativePath.startsWith(normalizedIgnorePattern); }); },