Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support solution path which is simply a filename. #7

Closed
wants to merge 3 commits into from

2 participants

@mpareja

Fixes launching like so: Giles -s MySolution.sln -t (...)

@mpareja mpareja Support solution path which is simply a filename.
Fixes launching like so: Giles -s MySolution.sln -t (...)
37014d2
@codereflection

Hey Mario! Can you see if this works with the latest bits?

@mpareja

I'll try and check this out later tonight.

@mpareja

I've merged all your recent changes from master into this branch and verified it still works as expected.

Here are the steps to reproduce the original bug:

cd <projects dir>\Giles\src
..\build\Giles.exe -s Giles.sln

Unhandled Exception: System.ArgumentException: The directory name is invalid.

@mpareja mpareja Merge branch 'master' into merge
Conflicts:
	src/Giles.Specs/Core/Watchers/SourceWatcherSpecs.cs
4f59622
@codereflection

Damn, looks like recent changes have broken the ability to auto merge this, sorry!! :(

@mpareja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 26, 2011
  1. @mpareja

    Support solution path which is simply a filename.

    mpareja authored
    Fixes launching like so: Giles -s MySolution.sln -t (...)
Commits on Sep 8, 2011
  1. @mpareja
Commits on Sep 14, 2011
  1. @mpareja

    Merge branch 'master' into merge

    mpareja authored
    Conflicts:
    	src/Giles.Specs/Core/Watchers/SourceWatcherSpecs.cs
This page is out of date. Refresh to see the latest.
View
15 src/Giles.Core/Watchers/SourceWatcher.cs
@@ -62,9 +62,9 @@ void buildTimer_Elapsed(object sender, ElapsedEventArgs e)
public void Watch(string solutionPath, string filter)
{
- var solutionFolder = fileSystem.GetDirectoryName(solutionPath);
- var fileSystemWatcher = fileWatcherFactory.Build(solutionFolder, filter, ChangeAction, null,
- ErrorAction);
+ string solutionFolder = GetSolutionFolder(solutionPath);
+ var fileSystemWatcher = fileWatcherFactory.Build(solutionFolder,
+ filter, ChangeAction, null, ErrorAction);
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.NotifyFilter = NotifyFilters.LastWrite;
fileSystemWatcher.IncludeSubdirectories = true;
@@ -72,6 +72,15 @@ public void Watch(string solutionPath, string filter)
FileWatchers.Add(fileSystemWatcher);
}
+ private string GetSolutionFolder(string solutionPath)
+ {
+ var solutionFolder = fileSystem.GetDirectoryName(solutionPath);
+ // handle relative solution path that was only a filename
+ if (solutionFolder == string.Empty)
+ solutionFolder = "." + Path.DirectorySeparatorChar;
+ return solutionFolder;
+ }
+
public void ErrorAction(object sender, ErrorEventArgs e)
{
throw new NotImplementedException();
View
16 src/Giles.Specs/Core/Watchers/SourceWatcherSpecs.cs
@@ -67,6 +67,20 @@ public class when_starting_to_watch_files : with_a_source_watcher
fileSystem.Received().GetDirectoryName(path);
}
+ public class when_the_solution_path_is_a_relative_filename : with_a_source_watcher
+ {
+ Establish context = () => {
+ path = "mySolution.sln";
+ fileSystem.GetDirectoryName(path).ReturnsForAnyArgs(info => Path.GetDirectoryName(info.Arg<string>()));
+ };
+
+ Because of = () =>
+ watcher.Watch(path, filter);
+
+ It watch_files_in_the_current_directory = () =>
+ fileWatcherFactory.Received().Build(@".\", filter, Arg.Any<FileSystemEventHandler>(), Arg.Any<FileSystemEventHandler>(), Arg.Any<ErrorEventHandler>());
+ }
+
public class when_a_file_has_changed : with_a_source_watcher
{
@@ -98,4 +112,4 @@ public class when_disposing : with_a_source_watcher
It should_call_dispose_on_each_file_watcher = () =>
watcher.FileWatchers.All(x => x == null);
}
-}
+}
Something went wrong with that request. Please try again.