diff --git a/src/expand.cpp b/src/expand.cpp index 37de2f2f0..4d0352579 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -834,11 +834,8 @@ static void expand_home_directory(wcstring &input, const environment_t &vars) { } } - maybe_t realhome; - if (home) realhome = normalize_path(*home); - - if (realhome) { - input.replace(input.begin(), input.begin() + tail_idx, *realhome); + if (home) { + input.replace(input.begin(), input.begin() + tail_idx, normalize_path(*home)); } else { input[0] = L'~'; }