#ifdef CA65_INC
AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC));
#endif
+
+ /* Add paths relative to the parent directory of the Windows binary. */
+ AddSubSearchPathFromWinBin (IncSearchPath, "asminc");
}
#ifdef CC65_INC
AddSearchPath (SysIncSearchPath, STRINGIZE (CC65_INC));
#endif
+
+ /* Add paths relative to the parent directory of the Windows binary. */
+ AddSubSearchPathFromWinBin (SysIncSearchPath, "include");
}
+void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir)
+{
+/* Windows only:
+ * Add a search path from the running binary, adding a subdirectory to
+ * the parent directory of the directory containing the binary.
+ */
+#if defined(_MSC_VER)
+
+ char Dir[_MAX_PATH];
+ char* Ptr;
+
+ if (_get_pgmptr (&Ptr) != 0) {
+ return;
+ }
+ strcpy (Dir, Ptr);
+
+ /* Remove binary name */
+ Ptr = strrchr (Dir, '\\');
+ if (Ptr == 0) {
+ return;
+ }
+ *Ptr = '\0';
+
+ /* Check for 'bin' directory */
+ Ptr = strrchr (Dir, '\\');
+ if (Ptr == 0) {
+ return;
+ }
+ if (strcmp (Ptr++, "\\bin") != 0) {
+ return;
+ }
+
+ /* Append SubDir */
+ strcpy (Ptr, SubDir);
+
+ /* Add the search path */
+ AddSearchPath (P, Dir);
+
+#endif
+}
+
+
int PushSearchPath (SearchPath* P, const char* NewPath)
/* Add a new search path to the head of an existing search path list, provided
* that it's not already there. If the path is already at the first position,
* the environment variable value.
*/
+void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir);
+/* Windows only:
+ * Add a search path from the running binary, adding a subdirectory to
+ * the parent directory of the directory containing the binary.
+ */
+
int PushSearchPath (SearchPath* P, const char* NewPath);
/* Add a new search path to the head of an existing search path list, provided
* that it's not already there. If the path is already at the first position,
/* Add paths relative to a main directory defined in an env. var. */
AddSubSearchPathFromEnv (LibDefaultPath, "CC65_HOME", "lib");
- AddSubSearchPathFromEnv (ObjDefaultPath, "CC65_HOME", "obj");
+ AddSubSearchPathFromEnv (ObjDefaultPath, "CC65_HOME", "lib");
AddSubSearchPathFromEnv (CfgDefaultPath, "CC65_HOME", "cfg");
/* Add some compiled-in search paths if defined at compile time. */
#if defined(LD65_CFG)
AddSearchPath (CfgDefaultPath, STRINGIZE (LD65_CFG));
#endif
+
+ /* Add paths relative to the parent directory of the Windows binary. */
+ AddSubSearchPathFromWinBin (LibDefaultPath, "lib");
+ AddSubSearchPathFromWinBin (ObjDefaultPath, "lib");
+ AddSubSearchPathFromWinBin (CfgDefaultPath, "cfg");
}