-
Notifications
You must be signed in to change notification settings - Fork 208
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
Fix bug + Add FS Event for iOS #20
Conversation
Using _rawValue in API calls to avoid empty string which may cause crash. Using isAny to detect any type of file exists at path. Using stdWithTilde to standardize the path without expanding tilde. Better support for relative path. Like Path("./../dir1/../dir2/file/.//").parent is Path("../../dir2/file") Annotations for follow links or not. Support for expanding tilde.
These are some great changes overall, however there's a number of issues/quirks that should be fixed before merging. Great idea with the Can you please change static properties' names from caps to upper camel case? For example, GCDVNodeEvents and GCDSourceType. Also, if the name is shortened, expand it. For example, "ATTRIB" should be "Attribute". Please don't make a type public if it has no public values or methods, such as with Also, Also, please expand "std" to "standard" in property names. Public API shouldn't be prefixed with "", such as in the case with "rawValue" for The manual initializer and Many of the |
rename "GCDVNodeEvents" to "DispatchVnodeEvents" rename "GCDSourceType" to "DispatchSourceType" rename "GCDVNodeWatcher" to "DispatchVnodeWatcher" rename "GCDFSWatcherDelegate" to "DispatchVnodeWatcherDelegate" public "_rawValue" -> private "_rawValue", use "safeRawValue" instead _fileManager -> unsafeFileManager
fix crash on unowned self. call watch2 when on OSX.
Thanks for the contributions! |
Since keyword I keep I change the name
Since there is a lot of changes, maybe exist some bugs. Anyway thanks for your work too! |
The GCD-based watch() function seems to work a lot more nicely than the filesystem event one. I might discard that one in place of this. From my understanding, watchOS and tvOS work pretty much just like how iOS does. I could be wrong, though. Edit: When using your watch() function in the FileKit playground, the callback is never called on iOS and tvOS. However, on OS X it is. |
I figure out why this happened. When watch a non exists path, an asynchronous delegate/blocks is set to monitor its parent. Even call I test it on a real iOS device, this happens less. However, change the code from The Edit: I have done some more test, weird behavior still happens. General reason is that: after
The order is unpredictable. Maybe call Edit: I add some test and bugfix on https://github.com/ijumps/FileKit/tree/bugfix-watch, more details can be found in the iOS test file. Behave differs between test on a simulator and a device. It's more likely to lose some events on a simulator. Create event implement by a non native GCD api. Maybe lose some events even on a device |
Add GCD based FS Event. Support for iOS
Fix bug: crash when
NSFileManager
delegate deinit.Fix bug:
commonAncestor
Fix bug: miss self in
FileKit/Core/File.swift
Using
_rawValue
in API calls to avoid empty string which may cause crash.Using
isAny
to detect any type of file exists at path.Using
stdWithTilde
to standardize the path without expanding tilde.Better support for relative path. Like Path("./../dir1/../dir2/file/.//").parent is Path("../../dir2/file")
Annotations for follow links or not.
Support for expanding tilde.