Mercurial > sdl-ios-xcode
changeset 855:aa4ac9e65d92
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).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Feb 2004 18:58:40 +0000 |
parents | 59a93320f326 |
children | d3165b90ee42 |
files | src/main/beos/SDL_BeApp.cc |
diffstat | 1 files changed, 12 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/beos/SDL_BeApp.cc Tue Feb 24 16:21:19 2004 +0000 +++ b/src/main/beos/SDL_BeApp.cc Tue Feb 24 18:58:40 2004 +0000 @@ -65,27 +65,20 @@ 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);