Skip to content

Commit 477cc11

Browse files
method to create index dir
1 parent f830ee4 commit 477cc11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cli.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,17 @@ impl Options {
427427
&self.local_staging_path
428428
}
429429

430+
/// Path to index directory, ensures that it exists or returns the PathBuf
431+
pub fn index_dir(&self) -> Option<&PathBuf> {
432+
if let Some(path) = &self.index_storage_path {
433+
fs::create_dir_all(path)
434+
.expect("Should be able to create index directory if it doesn't exist");
435+
Some(path)
436+
} else {
437+
None
438+
}
439+
}
440+
430441
/// TODO: refactor and document
431442
pub fn get_url(&self, mode: Mode) -> Url {
432443
let (endpoint, env_var) = match mode {

0 commit comments

Comments
 (0)