diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 01:48:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-12 01:48:53 +0100 |
commit | 99e02766ff36813ecb2a71b11993a876a5e42cad (patch) | |
tree | 504426886597cb94bc8e615233e105ab705541e2 /loader | |
parent | 3f6ba6056c5c63249022e52b3c6000e337856d1a (diff) |
actually `Path::split()` works
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader-impl.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
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!"); } |