diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc index a736a9f097..be41676c7a 100644 --- a/src/main/haiku/SDL_BeApp.cc +++ b/src/main/haiku/SDL_BeApp.cc @@ -118,9 +118,13 @@ static int StartBeLooper() } while ((!be_app) || be_app->IsLaunching()); } - /* Change working directory to that of executable */ + /* If started from the GUI, change working directory to that of executable. + * This matches behavior on other platforms and may be needed by some SDL software. + * Don't do it when started from terminal (TERM environment variable is set), because in that + * case, the current directory may be important, and after this there will be no way to know + * what it was. */ app_info info; - if (B_OK == be_app->GetAppInfo(&info)) { + if (NULL == getenv("TERM") && B_OK == be_app->GetAppInfo(&info)) { entry_ref ref = info.ref; BEntry entry; if (B_OK == entry.SetTo(&ref)) {