Use the function defined in the "common" module.
Move the check for not-nil filename from common.normalize_path
to core.open_doc. In this latter the filename can be nil if a
new unnamed document is created.
When scanning a subdirectory on-demand ensure files aready present
are not added twice. Files or directory can be already present due
to dir monitoring create message.
Fix check for ignore files when adding a file to respond to a dir monitor
event to use each part of the file's path.
Fix C function to compare files for treeview placement.
Introduce a new field in items generated by TreeView:each_item()
to point "dir" to the toplevel directory entry.
In this was we can simplify the code and know if the toplevel
directory is files limited.
Verity if dmon_watch returns an error.
Add a check if an added file for which we received a create event is
ignored based on the user's config.
Add some explanatory comments in the code.
In the treeview the implementation was checking the files list
to detect if it changed because of a project scan. Since we removed
the project scan we no longer need the check.
Removed the TreeView's self.last table that stores previous files
object by top-level directories.
Since the directory monitoring is now basically working we remove the
project scan thread periodically scanning the project directory.
Each project's directory is scanned only once at the beginning when
calling the function `core.add_project_directory` and is updated
incrementally when directory change events are treated.
The config variable `project_scan_rate` is removed as well as the
function `core.reschedule_project_scan`.
Now we request a watch on the directory and we manage sending
and receiving directory change events.
The mechanism to update on the fly the directory scan is not complete.
The code to remove a file is there but we need to implement the code
to add a new file.
It is reported that the built-in lua function os.remove(path) does
not removes empty directories on windows. To fix this a system.rmdir
function is introduced that calls a native win32 function.
Also common.rm(path, recursively) was added which wraps system.rmdir()
to easily delete an entire folder with all its contents.