From 99e02766ff36813ecb2a71b11993a876a5e42cad Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 12 Nov 2022 01:48:53 +0100 Subject: actually `Path::split()` works --- loader/loader-impl.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'loader') diff --git a/loader/loader-impl.cpp b/loader/loader-impl.cpp index 62fad6de..a7716000 100644 --- a/loader/loader-impl.cpp +++ b/loader/loader-impl.cpp @@ -167,14 +167,10 @@ void loader_impl::set_application_working_directory() once = true; if (const auto loc = Path::executableLocation()) { - auto path = *loc; - if (const auto pos = path.findLast('/'); pos) - { - const auto size = std::size_t(pos.data() - path.data()); - path = path.prefix(size); - loader_detail::chdir(Path::join(path, "..")); - return; - } + StringView path = *loc; + path = Path::split(path).first(); + path = Path::split(path).first(); + loader_detail::chdir(path); } fm_warn("can't find install prefix!"); } -- cgit v1.2.3