Skip to content

Commit

Permalink
Merge branch 'release/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rastersize committed Aug 3, 2010
2 parents 79c2467 + ccc044c commit c728faf
Show file tree
Hide file tree
Showing 7 changed files with 1,551 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pbxproj binary
*.m diff=objc
*.mm diff=objc
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
build

*.perspectivev3
*.pbxuser
*.perspective
*.mode1v3
*.mode2v3
*.tm_build_errors
!default.pbxuser
!default.perspectivev3
!default.mode1v3
!default.mode2v3

*~.nib
*~.xib

.DS_Store

api
8 changes: 4 additions & 4 deletions CDEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ static void CDEventsCallback(
for (NSUInteger i = 0; i < numEvents; ++i) {
shouldIgnore = NO;

NSString *eventPath = [eventPathsArray objectAtIndex:i];
NSString *eventPath = [[eventPathsArray objectAtIndex:i]
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *eventURL = [NSURL URLWithString:eventPath];

if ([excludedURLs containsObject:[NSURL URLWithString:eventPath]]) {
if ([excludedURLs containsObject:eventURL]) {
shouldIgnore = YES;
} else if (excludedURLs != nil && [watcher ignoreEventsFromSubDirectories]) {
for (NSURL *URL in excludedURLs) {
Expand All @@ -257,8 +259,6 @@ static void CDEventsCallback(
}

if (!shouldIgnore) {
NSURL *eventURL = [NSURL URLWithString:eventPath];

CDEvent *event = [[CDEvent alloc] initWithIdentifier:eventIds[i]
date:[NSDate date]
URL:eventURL
Expand Down
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.0</string>
<string>1.1.1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
17 changes: 13 additions & 4 deletions README.mdown
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# CDEvents #

## What is this? ##
It's an Objective-C wrapper for Mac OS X's [FSEvents C API](http://developer.apple.com/mac/library/documentation/Darwin/Reference/FSEvents_Ref/FSEvents_h/index.html). Inspired and based upon the ([MIT-licensed]((http://www.opensource.org/licenses/mit-license.php)) open source project [SCEvents](http://stuconnolly.com/projects/code/) created by [Stuart Connolly](http://stuconnolly.com/).
It's an Objective-C wrapper for Mac OS X's [FSEvents C API](http://developer.apple.com/mac/library/documentation/Darwin/Reference/FSEvents_Ref/FSEvents_h/index.html). Inspired and based upon the ([MIT-licensed](http://www.opensource.org/licenses/mit-license.php)) open source project [SCEvents](http://stuconnolly.com/projects/code/) created by [Stuart Connolly](http://stuconnolly.com/).

## Requirements ##
Requires Mac OS X 10.5, since FSEvents were introduced in 10.5, and an Intel CPU. Supports both manual memory management and garbage collection.

## What differentiates CDEvents from SCEvents then? ##
Not all that much but a litle. First of all all classes and protocols are prefixed with `CD` instead of `SC`, I hope that won't be to hard to remember? Secondly `CDEvent` (the event data wrapper-class) is immutable in contrast to `SCEvent` which is mutable. The next reason, this is the initial reason why I decided to rewrite `SCEvents`, being that the class `SCEvents`' is a singleton. I couldn't find a good reason as to why it had been designed this way and for my project an ordinary `alloc`/`init` route would be a better choise.
Not all that much but a litle. First of all all classes and protocols are prefixed with `CD` instead of `SC`, I hope that won't be to hard to remember? Secondly `CDEvent` (the event data wrapper-class) is immutable in contrast to `SCEvent` which is mutable. The next difference, which were the initial reason why I decided to rewrite `SCEvents`, is that the class `SCEvents`' is a singleton something `CDEvents` isn't. I couldn't find a good reason as to why `SCEvents` had been designed that way and for my project a "normal" non-singleton class would be and is better.

Another difference between `CDEvents` and `SCEvents` is that `CDEvents` is available for both manual memory management and environments using garbage collection.

So I've some of the code from scratch and taken some from `SCEvents`.
So I've written some of the code from scratch and "taken" some from `SCEvents`.

## API documentation ##
You can generate API documentation with the help of [Doxygen](http://www.stack.nl/~dimitri/doxygen/). In Doxygen open the file `api.doxygen`, click the `Run` tab and then the `Run doxygen` button. When it's done you should have a directory (ignored by git) in the root of the project named `api` with a sub-directory `html` in which you will find `index.html` double-click and enjoy.

## Authors ##

* Aron Cedercrantz

## License ##
The code is released under the [MIT-license](http://www.opensource.org/licenses/mit-license.php).
The code is released under the [MIT-license](http://www.opensource.org/licenses/mit-license.php).

If you want, even though you really don't have to, I would love hearing what you use CDEvents for! Send me an email (first name @ last name dot se) or a [message via GitHub](http://github.com/inbox/new/rastersize).
8 changes: 5 additions & 3 deletions TestApp/CDEventsTestAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ @implementation CDEventsTestAppController
- (void)run
{
NSArray *watchedURLs = [NSArray arrayWithObject:
[NSURL URLWithString:NSHomeDirectory()]];
[NSURL URLWithString:[NSHomeDirectory()
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSArray *excludeURLs = [NSMutableArray arrayWithObject:
[NSHomeDirectory() stringByAppendingPathComponent:@"Downloads"]];
[[NSHomeDirectory() stringByAppendingPathComponent:@"Downloads"]
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

_events = [[CDEvents alloc] initWithURLs:watchedURLs
delegate:self];
[_events setExcludedURLs:excludeURLs];

NSLog(@"-[CDEventsTestAppController init]:\n%@\n------\n%@",
NSLog(@"-[CDEventsTestAppController run]:\n%@\n------\n%@",
_events,
[_events streamDescription]);
}
Expand Down
Loading

0 comments on commit c728faf

Please sign in to comment.