diff --git a/CMakeLists.txt b/CMakeLists.txt index 328a0e9..a413af4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(kte) include(GNUInstallDirs) set(CMAKE_CXX_STANDARD 20) -set(KTE_VERSION "1.11.1") +set(KTE_VERSION "1.11.2") # Default to terminal-only build to avoid SDL/OpenGL dependency by default. # Enable with -DBUILD_GUI=ON when SDL2/OpenGL/Freetype are available. diff --git a/main.cc b/main.cc index d166711..a68495a 100644 --- a/main.cc +++ b/main.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -255,7 +256,18 @@ main(int argc, char *argv[]) // Fall through: not a +number, treat as filename starting with '+' } - const std::string path = arg; + // Resolve to absolute path now, before any + // chdir (macOS GUI changes CWD to HOME before + // deferred opens are processed). + std::string path = arg; + try { + std::filesystem::path p(path); + if (p.is_relative()) { + path = std::filesystem::absolute(p).string(); + } + } catch (...) { + // Fall through with original path + } editor.RequestOpenFile(path, pending_line); pending_line = 0; // consumed (if set) }