From 7acf91224d29d7b67976670bcded083d20cc5686 Mon Sep 17 00:00:00 2001 From: borutr Date: Mon, 12 May 2003 19:28:33 +0000 Subject: [PATCH] fixed the problem with searching the DATADIR as the last resort on *nix git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2614 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCmain.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/SDCCmain.c b/src/SDCCmain.c index f2add64e..83d4db79 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -1787,15 +1787,16 @@ setDataPaths(const char *argv0) SNPRINTF(buf, sizeof buf, "%s" BIN2DATA_DIR, p); p = buf; } - else { #ifdef _WIN32 + else { /* this should never happen... */ wassertl(0, "Can't get binary path"); p = "."; -#else /* *nix paltform */ + } +#else + if (!pathExists(p)) p = DATADIR; /* last resort */ #endif - } if (options.printSearchDirs) printf("datadir: %s\n", p); @@ -1931,16 +1932,13 @@ main (int argc, char **argv, char **envp) setBinPaths(argv[0]); setDataPaths(argv[0]); - /* if print search dirs then exit */ - if (options.printSearchDirs) - exit(0); - /* if no input then printUsage & exit */ - if (!options.c1mode && !fullSrcFileName && !nrelFiles) - { - printUsage (); - exit (0); - } + if (!options.c1mode && !fullSrcFileName && !nrelFiles) { + if (!options.printSearchDirs) + printUsage(); + + exit(0); + } /* initMem() is expensive, but initMem() must called before port->finaliseOptions (). -- 2.47.2