MCPcopy Index your code
hub / github.com/endbasic/endbasic / make_canonical_with_extension

Method make_canonical_with_extension

std/src/storage/mod.rs:423–440  ·  view source on GitHub ↗

Converts a `raw_location`, which needn't exist but must represent a file (not a directory), to its canonical form. If `extension` is not empty, adds it to the location if it didn't not yet have nay.

(
        &self,
        raw_location: &str,
        extension: &str,
    )

Source from the content-addressed store, hash-verified

421 ///
422 /// If `extension` is not empty, adds it to the location if it didn't not yet have nay.
423 pub fn make_canonical_with_extension(
424 &self,
425 raw_location: &str,
426 extension: &str,
427 ) -> io::Result<String> {
428 let mut location = Location::new(raw_location)?;
429 if location.drive.is_none() {
430 location.drive = Some(self.current.clone());
431 }
432 if location.leaf_name().is_none() {
433 return Err(io::Error::new(
434 io::ErrorKind::NotFound,
435 format!("Missing file name in path '{}'", raw_location),
436 ));
437 }
438 location.set_extension(extension);
439 Ok(location.to_string())
440 }
441
442 /// Attaches a new `drive` with `name`, which was instantiated with `uri`.
443 ///

Callers 2

async_execMethod · 0.80
run_from_storage_pathFunction · 0.80

Calls 2

leaf_nameMethod · 0.80
set_extensionMethod · 0.80

Tested by

no test coverage detected