You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using cargo as dependency in my project. The function Workspace::new used with relative manifest_path does return error with message invalid path url `` . The same code, but using absolute manifest_path is working correctly.
Steps
Create project and add cargo as a dependency
Try to load workspace using relative manifest_path
Possible Solution(s)
If it's expected behavior it should be mentioned in documentation. Otherwise Workspace::new could transform relative path to absolute before using it.
Notes
Output of cargo version: dependency is defined like that cargo = "0.40".
Example code that isn't working:
use cargo::core::Workspace;use cargo::Config;fnmain(){let manifest_path = "Cargo.toml";let config = Config::default().unwrap();let workspace = Workspace::new(manifest_path.as_ref(),&config).unwrap();for member in workspace.members(){println!("{}", member.name());}}
Example of working code:
use cargo::core::Workspace;use cargo::Config;use std::env;fnmain(){let manifest_path = env::current_dir().unwrap().join("Cargo.toml");let config = Config::default().unwrap();let workspace = Workspace::new(&manifest_path,&config).unwrap();for member in workspace.members(){println!("{}", member.name());}}
The text was updated successfully, but these errors were encountered:
Problem
I'm using cargo as dependency in my project. The function
Workspace::new
used with relativemanifest_path
does return error with messageinvalid path url ``
. The same code, but using absolutemanifest_path
is working correctly.Steps
manifest_path
Possible Solution(s)
If it's expected behavior it should be mentioned in documentation. Otherwise
Workspace::new
could transform relative path to absolute before using it.Notes
Output of
cargo version
: dependency is defined like thatcargo = "0.40"
.Example code that isn't working:
Example of working code:
The text was updated successfully, but these errors were encountered: