Skip to content
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

ChangeWatcher.WatchChanges works only with absolute file patterns #780

Closed
inosik opened this issue Apr 30, 2015 · 8 comments
Closed

ChangeWatcher.WatchChanges works only with absolute file patterns #780

inosik opened this issue Apr 30, 2015 · 8 comments

Comments

@inosik
Copy link
Contributor

inosik commented Apr 30, 2015

Verified by this test case in GlobbingSpecs.cs:

It should_match_absolute_path = () =>
    IsMatch("docs/**/*.*", new [] { @"C:\dev\project\docs\help.md" });

Appending FAKE's currentDirectory to the pattern isn't a big deal, but then we should reflect this in the docs, because the tutorial shows a non-working sample. The api docs are correct.

/cc @voiceofwisdom

@xavierzwirtz
Copy link
Contributor

I didnt intend for absolute paths to be required, I'll take a look at fixing this.

@xavierzwirtz
Copy link
Contributor

IsMatch is supposed to work exactly like the existing glob implementation, except not requiring directory traversal to check for a match. Any differences in behavior I would consider a bug.

@xavierzwirtz
Copy link
Contributor

I made FileInclude add its base directory to the glob pattern when calling is match. Fixed in #782

@forki forki closed this as completed in #782 May 2, 2015
@forki
Copy link
Member

forki commented May 2, 2015

@voiceofwisdom could you please take a look at fsprojects/Paket#811

I have very strange behaviour.

  • clone project
  • checkout watcher branch
  • run build.cmd KeepRunning
  • open docs\content\faq.md and save the file (no edit needed)

==> The watcher starts to build the docs, but it goes into endless loop since it wrongly (?) detects edits in other content files (which I didn't change or save)

@forki forki reopened this May 2, 2015
@marisks
Copy link

marisks commented Jun 4, 2015

I also have issues with relative paths. Don't know if it is same issue.

I have FAKE project in D:\Projects\fake_test\fake_test\fake_test with build.fsx
I have folder to watch in D:\Projects\fake_test\watch_folder which is two levels up.
And when I configure Watch target to watch for changes to relative directory two levels up, it doesn't detect any changes to that folder.

let failureDir  = "../../watch_folder/"
Target "Watch" (fun _ ->
    use watcher = !! (failureDir @@ "*.*") |> WatchChanges (fun changes -> 
        tracefn "%A" changes
    )
    System.Console.ReadLine() |> ignore 
    watcher.Dispose() 
)

But when I use absolute path: D:/Projects/fake_test/watch_folder/, it works fine.

I created sample project to reproduce the issue: https://github.com/marisks/fake_test

@xavierzwirtz
Copy link
Contributor

The watcher uses an alternative implementation of the globbing syntax. It does not support relative paths as it stands. 😞

Fake.Globbing.isMatch would have to be extended to accept the current directory as well, and take that into account when matching globs.

@marisks
Copy link

marisks commented Jun 5, 2015

For now I am just using Path.GetFullPath as a workaround:

let fullDir = Path.GetFullPath relativeDir

@matthid
Copy link
Member

matthid commented May 6, 2017

The original issue seems to be fixed. Can someone open a new issue for the part which is still open (and explain what the issue is)?

@matthid matthid closed this as completed May 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants