@@ -230,6 +230,14 @@ impl<'cfg> Workspace<'cfg> {
230
230
/// if some other transient error happens.
231
231
fn find_root ( & mut self , manifest_path : & Path )
232
232
-> CargoResult < Option < PathBuf > > {
233
+ fn read_root_pointer ( member_manifest : & Path , root_link : & str ) -> CargoResult < PathBuf > {
234
+ let path = member_manifest. parent ( ) . unwrap ( )
235
+ . join ( root_link)
236
+ . join ( "Cargo.toml" ) ;
237
+ debug ! ( "find_root - pointer {}" , path. display( ) ) ;
238
+ return Ok ( paths:: normalize_path ( & path) )
239
+ } ;
240
+
233
241
{
234
242
let current = self . packages . load ( & manifest_path) ?;
235
243
match * current. workspace_config ( ) {
@@ -238,11 +246,7 @@ impl<'cfg> Workspace<'cfg> {
238
246
return Ok ( Some ( manifest_path. to_path_buf ( ) ) )
239
247
}
240
248
WorkspaceConfig :: Member { root : Some ( ref path_to_root) } => {
241
- let path = manifest_path. parent ( ) . unwrap ( )
242
- . join ( path_to_root)
243
- . join ( "Cargo.toml" ) ;
244
- debug ! ( "find_root - pointer {}" , path. display( ) ) ;
245
- return Ok ( Some ( paths:: normalize_path ( & path) ) )
249
+ return Ok ( Some ( read_root_pointer ( manifest_path, path_to_root) ?) )
246
250
}
247
251
WorkspaceConfig :: Member { root : None } => { }
248
252
}
@@ -258,6 +262,9 @@ impl<'cfg> Workspace<'cfg> {
258
262
debug ! ( "find_root - found" ) ;
259
263
return Ok ( Some ( manifest) )
260
264
}
265
+ WorkspaceConfig :: Member { root : Some ( ref path_to_root) } => {
266
+ return Ok ( Some ( read_root_pointer ( & manifest, path_to_root) ?) )
267
+ }
261
268
WorkspaceConfig :: Member { .. } => { }
262
269
}
263
270
}
0 commit comments