-
Notifications
You must be signed in to change notification settings - Fork 27
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
Reloading fails on Windows with Unix search path #17
Comments
Hi. Thanks for the report. Could you try to make a PR with this change? As I have some CI running for non-Windows platforms it should report if something goes bad. Cheers! |
So the tests didn't pass because I assume it's OK to pass a path that do not exist just in case the application creates the folder after DynamicReload was is instanced. |
Yeah. It may be a directory that gets populated later and things like that. |
@gabdube Does that mean if the folder is only created later (so the path only becomes valid after |
Just tested it and it panics. Do you think we could just create the path if it doesn't already exists? |
@gabdube I think it would make more sense to canonicalize the path as soon as it exists and the dll is loaded. |
@Boscop Not sure if that's possible because we are sending the path to the watcher and at that point its out of our control. |
@gabdube Ah right. I think the best solution would be to compare paths in a way that treats |
There's a new crate that could be very useful for this issue:
|
On nightly, std now has a function to make paths absolute without requiring the file to exist! https://doc.rust-lang.org/nightly/std/path/fn.absolute.html This would solve this issue but it's only on nightly for now. |
On windows, if a unix path is used in "search_paths" (ex:
DynamicReload::new(Some(vec!["./routes/target/debug/"]), Some("target/debug"), Search::Default);
), the changes to the libraries are not reported. This is most likely because dynamic_reload cannot match the path sent by the watcher to the one saved in the Lib.Here's an example of events that fails to be matched
ex:
RawEvent { path: Some("C:\\Users\\Gab\\Documents\\projects\\test\\./routes/target/debug\\routes.dll"), op: Ok(WRITE), cookie: None }
I've managed to fix this by mapping the path in
search_paths
with.canonicalize
. Therefore replacingsearch_paths: Vec<&'a str>
bysearch_paths: Vec<PathBuf>
With this the event becomes
RawEvent { path: Some("\\\\?\\C:\\Users\\Gab\\Documents\\projects\\test\\routes\\target\\debug\\routes.dll"), op: Ok(WRITE), cookie: None }
And everything works fine. Not exactly sure how this would impact non Windows OS though...
The text was updated successfully, but these errors were encountered: