From 0dc1625cff467eab7d6ea693bdf54aa716567a16 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Tue, 23 Apr 2024 15:59:33 +0200 Subject: [PATCH] Fix cwd not ending with path separator --- crates/lune-std-process/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index bd0d27c..adc4eb8 100644 --- a/crates/lune-std-process/src/lib.rs +++ b/crates/lune-std-process/src/lib.rs @@ -5,6 +5,7 @@ use std::{ self, consts::{ARCH, OS}, }, + path::MAIN_SEPARATOR, process::Stdio, }; @@ -33,10 +34,13 @@ use lune_utils::path::get_current_dir; */ #[allow(clippy::missing_panics_doc)] pub fn module(lua: &Lua) -> LuaResult { - let cwd_str = get_current_dir() + let mut cwd_str = get_current_dir() .to_str() .expect("cwd should be valid UTF-8") .to_string(); + if !cwd_str.ends_with(MAIN_SEPARATOR) { + cwd_str.push(MAIN_SEPARATOR); + } // Create constants for OS & processor architecture let os = lua.create_string(&OS.to_lowercase())?; let arch = lua.create_string(&ARCH.to_lowercase())?;