From e0aba101afbc177d9767bdc40eb4be17784cdb61 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 30 Jul 2002 12:24:55 +0000 Subject: [PATCH] base handling (changed again) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@99 --- src/dosbox.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 72f10c67..c8b99782 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -244,11 +244,18 @@ static void InitSystems(void) { void DOSBOX_Init(int argc, char* argv[]) { /* Find the base directory */ - getcwd(dosbox_basedir,CROSS_LEN); - char a[2]; - a[0]=CROSS_FILESPLIT; - a[1]='\0'; - strcat(dosbox_basedir,a); + strcpy(dosbox_basedir,argv[0]); + char * last=strrchr(dosbox_basedir,CROSS_FILESPLIT); //if windowsversion fails: + if (!last){ + getcwd(dosbox_basedir,CROSS_LEN); + char a[2]; + a[0]=CROSS_FILESPLIT; + a[1]='\0'; + strcat(dosbox_basedir,a); + } else { + *++last=0; + } + /* Parse the command line with a setup function */ int argl=1; if (argc>1) {