Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Adding initial implementation of the FileSystemWatcher on OS X #1193

Merged
merged 3 commits into from Mar 25, 2015
Merged

Adding initial implementation of the FileSystemWatcher on OS X #1193

merged 3 commits into from Mar 25, 2015

Conversation

jonmill
Copy link

@jonmill jonmill commented Mar 20, 2015

No description provided.

@jonmill
Copy link
Author

jonmill commented Mar 20, 2015

@stephentoub @ellismg

/// <summary>
/// This is the default system path for the CoreFoundation library that PInvoke will use
/// </summary>
private const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add an Interop.Libraries.cs file under src/Common/src/Interop/OSX, and put this constant in there.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@stephentoub
Copy link
Member

Thanks, Jon. Good start. Took a first pass through and left a bunch of comments. I can review it again when you've taken a pass through to address them.

@ellismg
Copy link
Contributor

ellismg commented Mar 22, 2015

@sokket, When you get a chance can you update your git user.email to be the microsoft.com address you have registered with your github account and then update your commit with git commit --amend --reset-author?

Right now it is showing up as an outlook.com address.

Debug.Assert(_watcherRunLoop == IntPtr.Zero);

// Make sure we only do this if there is a valid directory
if (String.IsNullOrEmpty(_directory) == false)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be if (!String.IsNullOrEmpty(_directory)) instead of checking for == false?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They both provide the same functionality but I prefer the == false since it's so easy to miss the preceding ! and misread the conditional. If there's strong preference or precedence to using ! over == false then I'll go ahead and change it

@jonmill
Copy link
Author

jonmill commented Mar 23, 2015

Updated with feedback!

@@ -251,6 +249,7 @@ private sealed class RunningInstance
_includeSubdirectories = includeSubdirectories;
_notifyFilters = notifyFilters;
_cancellationToken = cancellationToken;
FileSystemWatcher.CaseSensitive = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ok, though what I'd had in mind was that each .Platform.cs file would still define its own CaseSensitive... in .Windows.cs and .Linux.cs it'd be a constant, and in .OSX.cs it'd be a property. That way, for the systems where it's a fixed constant, call sites could optimize appropriately. Not a big deal, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it a property on the base class since, technically, Windows and NTFS supports POSIX compliant-case-sensitivity for apps that support it (https://support.microsoft.com/en-us/kb/100625).

I believe you can also do some customization on Linux platforms to support case insensitivity, so to support all these potential scenarios, this seemed like the best option. I can change it back to constants if you'd like

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I don't feel strongly about it. We can always change it in the future if we so desire.

@stephentoub
Copy link
Member

Thanks, Jon. A few more minor comments, but otherwise LGTM. Thanks for all the fixes.

@ellismg
Copy link
Contributor

ellismg commented Mar 24, 2015

@dotnet-bot test this please

1 similar comment
@jonmill
Copy link
Author

jonmill commented Mar 25, 2015

@dotnet-bot test this please

jonmill pushed a commit that referenced this pull request Mar 25, 2015
Adding initial implementation of the FileSystemWatcher on OS X
@jonmill jonmill merged commit 3121b02 into dotnet:master Mar 25, 2015
@jonmill jonmill deleted the filesystemwatcher branch March 25, 2015 00:09
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
9 participants