Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'addDir' event is fired twice when file's name capitalization changes on MacOS #1255

Open
tomaszczura opened this issue Nov 28, 2022 · 1 comment
Labels

Comments

@tomaszczura
Copy link

Describe the bug

addDir event is fired twice when I change file's name capitalization, e.g. from Folder A to folder a - first event comes with Folder A, and the second with folder a

Versions (please complete the following information):

  • Chokidar version [3.5.3]
  • Node version [16.14.2]
  • OS version: [Mac OS 12.6 Monterey]

To Reproduce:

Steps to reproduce the behavior. Include filename and chokidar config.

Ideally prove a problem by isolating and making it reproducible with a very short sample program, which you could paste here:

import chokidar, { FSWatcher } from 'chokidar';
import fs from 'fs'

const watcher = chokidar.watch('./', {
	ignoreInitial: true,
})

watcher
.on('addDir', (addedPath) =>  console.log("ADDED:", addedPath))
.on('change', (changedPath) => console.log("CHANGED", changedPath))

if (!fs.existsSync('./myFolder')) {
	fs.mkdirSync('./myFolder');
}

setTimeout(() => {
	console.log("Change folder name");
	fs.renameSync('./myFolder', './myfolder');

	setTimeout(() => {
		console.log("Closing...")
		watcher.close();
		fs.rmSync('./myfolder', { force: true, recursive: true })
	}, 5000)
	
}, 2000)

Actual behavior
The output is:

ADDED: myFolder
Change folder name
ADDED: myFolder <-- this event should not be there - the file was renamed and does not exist
ADDED: myfolder
Closing...

Expected behavior
Output should be:

ADDED: myFolder
Change folder name
ADDED: myfolder
Closing...
@paulmillr paulmillr added the mac label Jan 10, 2023
@george-thomas-hill
Copy link

This is affecting me, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants