Path style aspen should stick to for the duration of its existence
Valid values are win32 or unix. Invalid value will implicitly mean unix.
Once Root is set up, almost all of the common path utils can be accessed through Root#pathfx object. Utils in this object are 100% compliant with specified pathStyle
Notes:
win32 paths are separated by backslash (\) as well as forward slash (/), but if aspen needs to merge paths, it'll only use \ for that purposeunix paths are separated ONLY by forward slash (/). Backslashes (\) in unix paths become part of the filename.Sorting comparator Directories should use when:
Root#forceLoadFileEntryAtPath is called and the target exists in a Directory that was not expaned previously (thus triggering a hard reload)WatchEvent.Moved, WatchEvent.Added and WatchEvent.Changed (but not on WatchEvent.Removed)REMINDER: Avoid using instanceof when checking if an item is Directory or FileEntry. instanceof is computationally expensive and not required for this purpose.
Use item.type === FileType.File to check if item is FileEntry and item.type === FileType.Directory to check for Directory
File watching
This method will be called whenever a Directory loads its contents to let the host know that aspen will be expecting notifications if any file(s) get added/removed/moved
Host and UI can stay in a perfect sync if host is good at notifying aspen about any changes.
Hereafter, use Root#inotify to dispatch the events (dispatch a properly formatted IWatcherEvent and Root will take care of the rest)
watch must return a function that aspen can call to terminate a watch session when it's no longer needed. The returned function will be called with the same path
which was used to start the watch in first place.
It is recommended that instead of returning a new function reference everytime, all calls to watch should return same function for each watch. That one function can
take the path parameter and terminate the associated watcher accordingly.
Generated using TypeDoc
Just slightly more than unix's
lscommandCalled when a Directory loads its contents
Do not waste computational time on sorting items just yet, return them as is (Specify
host.sortComparatorinstead)There is no need to sort raw items. The parent
Directorywill call yoursortComparatorfunction (if specified) once raw items are converted to "real" objectsArray of { name: string, type: FileType, attributes?: {[key: string]: any}}