Skip to content

Commit

Permalink
cli: Treat an empty syncfolder as not configured (#8)
Browse files Browse the repository at this point in the history
My `syncfolder` is set to an empty string.
I believe I had sync configured once and removed the folder since,
leaving me with an empty string.

This PR ignores empty strings and treats them as unconfigured.
Without that PR, the `workspaces` folder would be resolved
relative to the current dir, leading to file-not-found errors down the line.
  • Loading branch information
knutwalker authored Sep 20, 2022
1 parent 4a51d64 commit b71abd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/cli/src/alfred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ fn sync_directory() -> Result<PathBuf> {
.into_dictionary()
.context("expected dictionary")?
.remove("syncfolder")
.map(|dir| dir.into_string().context("expected string"))
.transpose()?
.filter(|dir| !dir.trim().is_empty())
{
Some(dir) => {
let dir = PathBuf::from(dir.into_string().context("expected string")?);
let dir = PathBuf::from(dir);
if let Ok(p) = dir.strip_prefix("~") {
home.join(p)
} else {
Expand Down

0 comments on commit b71abd0

Please sign in to comment.