diff --git a/src/julec/compile.jule b/src/julec/compile.jule index 1afb4a1a5..e9d8fb89b 100644 --- a/src/julec/compile.jule +++ b/src/julec/compile.jule @@ -202,10 +202,6 @@ fn gen_compile_cmd(source_path: str, &ir: &IR): (str, str) { } fn get_compile_path(): str { - // let mut path = join(PATH_WD, OUT_DIR) - // path = join(path, OUT_NAME) - // ret path - // Return command-line argument form // instead of absolute path. ret join(OUT_DIR, OUT_NAME) diff --git a/std/jule/build/env.jule b/std/jule/build/env.jule index 4358bb62d..f60370f36 100644 --- a/std/jule/build/env.jule +++ b/std/jule/build/env.jule @@ -27,24 +27,14 @@ fn init() { panic("std::jule::build: executable file cannot found") } - let pwd = env::working_dir() else { - panic("std::jule::build: working directory path cannot found") - ret // To avoid assignment error. - } - - let path_exec = path::dir(path) - - // Go to parent directory. - path = path::join(path_exec, "..") - // Break immutability to assign paths. unsafe { - *(&PATH_WD) = pwd - *(&PATH_EXEC) = path_exec - *(&PATH_STDLIB) = path::join(path, STDLIB) - - *(&PATH_API) = path::join(PATH_EXEC, "..") - *(&PATH_API) = path::join(PATH_API, "api") - *(&PATH_API) = path::join(PATH_API, "jule.hpp") + *(&PATH_WD) = env::working_dir() else { + panic("std::jule::build: working directory path cannot found") + ret // To avoid assignment error. + } + *(&PATH_EXEC) = path::dir(path) + *(&PATH_STDLIB) = path::join(PATH_EXEC, "..", STDLIB) + *(&PATH_API) = path::join(PATH_EXEC, "..", "api", "jule.hpp") } } \ No newline at end of file diff --git a/std/strings/strings.jule b/std/strings/strings.jule index 550f1d054..33f2997a6 100644 --- a/std/strings/strings.jule +++ b/std/strings/strings.jule @@ -455,12 +455,15 @@ pub fn trim(s: str, cutset: str): str { // Concatenates the parts of its first argument to create a single string. // The separator sep is placed between parts in the resulting string. pub fn join(parts: []str, sep: str): str { - if parts.len == 0 { + match parts.len { + | 0: ret "" + | 1: + ret parts[1] } let mut n = 0 if sep.len > 0 { - if sep.len >= int.MAX/parts.len-1 { + if sep.len >= int.MAX/(parts.len-1) { panic("std::strings: join: output length overflow") } n += sep.len * (parts.len - 1)