Skip to main content

cached_path

Function cached_path 

Source
pub fn cached_path(source: &str, ext: &str) -> String
Expand description

Compute the cache path for a source asset.

The cache file is placed in an optc/ subdirectory next to the source file, with the given extension replacing the original:

use optic_file::cached_path;

assert_eq!(cached_path("assets/tex/foo.png", "otxtr"),
           "assets/tex/optc/foo.otxtr");
assert_eq!(cached_path("foo.png", "omesh"),
           "optc/foo.omesh");