From 64b6d7881266ccdb04b62e036cc3dc8f4ebd2dde Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 24 Feb 2004 18:58:40 +0000 Subject: [PATCH] I noticed MacOSX SDL sets up working directory to parent of executable. On BeOS is should setup it the same way, but it only does when Tracker wasn't restarted. I checked code and it looks like a hack to me :( It looks for env variable and than comapres it to default when OpenTracker was started after boot, and wasn't restarted. That's probably ok, for that exact case. Unfortunetly that variable isn't always like that. For example, after Tracker crashes and is restarted, env variable most probably is different (depends on how Tracker was restarted, by what application, etc... for example: i have launcher application from which i can restart Tracker, and after that nev variable points to that application's directory, not Tracker's). --- src/main/beos/SDL_BeApp.cc | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/beos/SDL_BeApp.cc b/src/main/beos/SDL_BeApp.cc index 056b3e7a9..fb0cc3c76 100644 --- a/src/main/beos/SDL_BeApp.cc +++ b/src/main/beos/SDL_BeApp.cc @@ -65,27 +65,20 @@ int SDL_InitBeApp(void) return(-1); } - /* Check if we started from Terminal or Tracker... */ - /* Based on code posted to BeDevTalk by Marco Nelissen */ - char *cmd = getenv("_"); - if(!(cmd == NULL || strlen(cmd) < 7) && - (!strcmp(cmd + strlen(cmd) - 7 , "Tracker"))) { - - /* Change working to directory to that of executable */ - app_info info; - if (B_OK == be_app->GetAppInfo(&info)) { - entry_ref ref = info.ref; - BEntry entry; - if (B_OK == entry.SetTo(&ref)) { - BPath path; - if (B_OK == path.SetTo(&entry)) { - if (B_OK == path.GetParent(&path)) { - chdir(path.Path()); - } + /* Change working to directory to that of executable */ + app_info info; + if (B_OK == be_app->GetAppInfo(&info)) { + entry_ref ref = info.ref; + BEntry entry; + if (B_OK == entry.SetTo(&ref)) { + BPath path; + if (B_OK == path.SetTo(&entry)) { + if (B_OK == path.GetParent(&path)) { + chdir(path.Path()); } } - } - } /* else started from Terminal */ + } + } do { SDL_Delay(10);