From f9fe6efebf3ce4e32d93705db8decc2019f7112f Mon Sep 17 00:00:00 2001 From: Canop Date: Wed, 23 Mar 2022 19:12:33 +0100 Subject: escape spaces in sourcing path in shell script install Fix #520 (hopefully, not really tested) --- .gitignore | 1 + src/cli/app_launch_args.rs | 1 - src/shell_install/bash.rs | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 05a9b96..b34d908 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ deploy.sh /trav /press /glassbench_*.db +.bacon-locations diff --git a/src/cli/app_launch_args.rs b/src/cli/app_launch_args.rs index a1fe479..03b25ae 100644 --- a/src/cli/app_launch_args.rs +++ b/src/cli/app_launch_args.rs @@ -1,4 +1,3 @@ - use { crate::{ tree::TreeOptions, diff --git a/src/shell_install/bash.rs b/src/shell_install/bash.rs index e98dbc3..7be3b31 100644 --- a/src/shell_install/bash.rs +++ b/src/shell_install/bash.rs @@ -128,7 +128,8 @@ pub fn install(si: &mut ShellInstall) -> Result<(), ProgramError> { si.skin.print_text(MD_NO_SOURCING); return Ok(()); } - let source_line = format!("source {}", &link_path.to_string_lossy()); + let escaped_path = link_path.to_string_lossy().replace(' ', "\\ "); + let source_line = format!("source {}", &escaped_path); for sourcing_path in &sourcing_paths { let sourcing_path_str = sourcing_path.to_string_lossy(); if util::file_contains_line(sourcing_path, &source_line)? { -- cgit v1.2.3