cargo-c: cinstall: destdir path joining problems on Windows with absolute paths

I run

cargo cinstall --release --frozen --library-type=cdylib --destdir=C:/foo

but things get installed into C:/usr:

C:/usr/
└── local
    ├── bin
    │   └── rav1e.dll
    ├── include
    │   └── rav1e
    │       └── rav1e.h
    └── lib
        ├── librav1e.dll.a
        ├── pkgconfig
        │   └── rav1e.pc
        └── rav1e.def

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (14 by maintainers)

Commits related to this issue

Most upvoted comments

my attempt 😃

fn append_to_destdir(destdir: &PathBuf, path: &PathBuf) -> PathBuf {
    let mut components = path.components();
    while components.as_path().has_root() {
        components.next();
    }
    destdir.join(components.as_path())
}