Skip to content

Commit f672c63

Browse files
committed
fix(#1076): improve handling of missing plugin directory
Signed-off-by: Brian H <brian.hardock@fermyon.com>
1 parent f70c2b6 commit f672c63

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/plugins/src/store.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, Result};
1+
use anyhow::{anyhow, Context, Result};
22
use flate2::read::GzDecoder;
33
use std::{
44
ffi::OsStr,
@@ -85,8 +85,15 @@ impl PluginStore {
8585
// |- bar.json
8686
let catalogue_dir =
8787
crate::lookup::spin_plugins_repo_manifest_dir(self.get_plugins_directory());
88+
89+
// Catalogue directory doesn't exist so likely nothing has been installed.
90+
if !catalogue_dir.exists() {
91+
return Ok(Vec::new());
92+
}
93+
8894
let plugin_dirs = catalogue_dir
89-
.read_dir()?
95+
.read_dir()
96+
.context("reading manifest catalogue at {catalogue_dir:?}")?
9097
.filter_map(|d| d.ok())
9198
.map(|d| d.path())
9299
.filter(|p| p.is_dir());

0 commit comments

Comments
 (0)