WSL doesn't update when Windows file system is updated
Here is my issue:
- I edit a file on Windows, using a Windows file editor.
- I save it to my Documents folder.
- I try to compile the file on WSL using gcc.
- If I saved the file as a new file, I can find it and work with it.
- If I save the file without creating a new file (just using Ctrl+S), WSL doesn't notice the changes.
cat file.c
shows the old file, and there is no way to update it.
Is there any way to make WSL recognise that the file has been updated, and show the new version?
Solution 1:
Assuming you're running Windows 10 Creators Update or later, WSL does support File Change Notifications via iNotify, so if you open & edit a file in gedit, VSCode, Sublime, Notepad, Notepad++, etc. and hit save, the file will be updated and WSL should receive the inotify file change notification.
Note: If you repeatedly hit CTRL+S in some editors, they won't write to the file until the editor's contents have changed. Try inserting and deleting a space (to fool the editor into thinking its contents have changed) and re-saving afterwards.
Alternatively, try another editor (e.g. one listed above).