From e80d3b3f1b9606205ac24bea470710abed621801 Mon Sep 17 00:00:00 2001 From: Pragadesh-45 Date: Wed, 13 Nov 2024 21:30:58 +0530 Subject: [PATCH] fix: enhance path normalization for WSL compatibility in watcher --- 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 82d116d814..a26ff5d53c 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); }); },