From 29376b080f51718c81b46bb1bc75e825ef0073d6 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 8 Jan 2021 18:16:40 +0000 Subject: [PATCH] Launch path support --- mjpeg-player.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mjpeg-player.cpp b/mjpeg-player.cpp index 60e784b..813c6b3 100644 --- a/mjpeg-player.cpp +++ b/mjpeg-player.cpp @@ -70,6 +70,17 @@ void init() fileBrowser.set_display_rect(blit::Rect(0, 0, blit::screen.bounds.w, blit::screen.bounds.h)); fileBrowser.set_on_file_open(openFile); fileBrowser.init(); + + auto launchPath = blit::get_launch_path(); + if(launchPath) + { + std::string pathStr(launchPath); + auto pos = pathStr.find_last_of('/'); + if(pos != std::string::npos) + fileBrowser.set_current_dir(pathStr.substr(0, pos)); + + openFile(launchPath); + } } void render(uint32_t time_ms)