Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slint-viewer: handle path being renamed and replaced
Some editors, such as vim, rename (move) a file to a backup location, then write the new contents to a new location when the user saves their changes. notify stops watching the renamed file, and does not automatically start watching the new file created. Additionally, slint-viewer attempts to reload before the editor has written the new file, which causes an error. The file is then never reloaded because the watcher was lost. This patch solves the problem by attempting to watch the file again, if the previous watch failed due to a Generic or PathNotFound error. Generic is required because this is error type we get on macOS for "No such file or directory.". We delay the retry by a small timeout to give the editor a chance to write the new file. Note that this still results in an error being printed about the missing file. Tested manually by editing both root .slint file, and .slint files imported from sub-directories. Closes: slint-ui#3641
- Loading branch information