Skip to main content

strip_component

Function strip_component 

Source
pub fn strip_component(source: impl AsRef<Path>) -> Result<PathBuf, Error>
Expand description

Extract the top-level directory from an unpacked archive.

The specification says:

A .tar.gz source distribution (sdist) contains a single top-level directory called {name}-{version} (e.g. foo-1.0), containing the source files of the package.

This function returns the path to that top-level directory.