Skip to content

Commit

Permalink
add mono fix in 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
skotzko committed Mar 3, 2015
1 parent 56b0062 commit 08c90e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Unit-1/lesson4/Completed/FileObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public FileObserver(ActorRef tailActor, string absoluteFilePath)
/// </summary>
public void Start()
{
// Need this for Mono 3.12.0 workaround
// uncomment this line if you're running on Mono!
// Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled");

// make watcher to observe our specific file
_watcher = new FileSystemWatcher(_fileDir, _fileNameOnly);

Expand Down
5 changes: 4 additions & 1 deletion src/Unit-1/lesson4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private void DoPrintInstructions()
#### Add `FileObserver`
This is a utility class that we're providing for you to use. It does the low-level work of actually watching a file for changes.

Create a new class called `FileObserver` and copy in the code for [FileObserver.cs](Completed/FileObserver.cs):
Create a new class called `FileObserver` and type in thi code for [FileObserver.cs](Completed/FileObserver.cs). If you're running this on Mono, note the extra environment variable that has to be uncommented in the `Start()` method:

```csharp
// FileObserver.cs
Expand Down Expand Up @@ -373,6 +373,9 @@ namespace WinTail
/// </summary>
public void Start()
{
// Need this for Mono 3.12.0 workaround
// Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled"); // uncomment this line if you're running on Mono!
// make watcher to observe our specific file
_watcher = new FileSystemWatcher(_fileDir, _fileNameOnly);

Expand Down

0 comments on commit 08c90e8

Please sign in to comment.