]> git.gag.com Git - fw/sdcc/commitdiff
fixed the problem with searching the DATADIR as the last resort on *nix
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 12 May 2003 19:28:33 +0000 (19:28 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 12 May 2003 19:28:33 +0000 (19:28 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2614 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmain.c

index f2add64e18937cc478e7d6063ec36bdf767b14cb..83d4db79b205508ced2878780294407ca668215f 100644 (file)
@@ -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 ().