va_end(argPtr);\r
}\r
}\r
+\r
+//==========================================================================\r
+//\r
+// MS_IsPathAbsolute\r
+//\r
+// Pascal 30/11/08\r
+//\r
+//==========================================================================\r
+\r
+boolean MS_IsPathAbsolute(char *name)\r
+{\r
+#ifdef WIN32\r
+ // In windows, the second character must be : if it is an\r
+ // absolute path (the first character indicates the drive)\r
+ if(name[0] != '\0')\r
+ return (name[1] == ':') ? TRUE : FALSE;\r
+ else\r
+ return FALSE;\r
+#else\r
+ // In linux, the first character must be / for a root path\r
+ return (name[0] == '/') ? TRUE : FALSE;\r
+#endif\r
+}\r
void MS_StripFileExt(char *name);\r
boolean MS_StripFilename(char *path);\r
void MS_Message(msg_t type, char *text, ...);\r
+boolean MS_IsPathAbsolute(char *name);\r
\r
// PUBLIC DATA DECLARATIONS ------------------------------------------------\r
\r
static char *FileNames;\r
static size_t FileNamesLen, FileNamesMax;\r
\r
-// Pascal 11/12/08\r
+// Pascal 12/11/08\r
// Include paths. Lowest is searched first.\r
// Include path 0 is always set to the directory of the file being parsed.\r
static char IncludePaths[MAX_INCLUDE_PATHS][MAX_FILE_NAME_LENGTH];\r
// AddIncludePath\r
// This adds an include path with less priority than the ones already added\r
// \r
-// Pascal 11/12/08\r
+// Pascal 12/11/08\r
//\r
//==========================================================================\r
\r
// SetLocalIncludePath\r
// This sets the first include path\r
// \r
-// Pascal 11/12/08\r
+// Pascal 12/11/08\r
//\r
//==========================================================================\r
\r
info->lastChar = Chr;\r
info->imported = NO;\r
\r
- // Pascal 11/12/08\r
- // Find the file in the include paths\r
- for(i = 0; i < NumIncludePaths; i++)\r
+ // Pascal 30/11/08\r
+ // Handle absolute paths\r
+ if(MS_IsPathAbsolute(fileName))\r
{\r
- strcpy(sourceName, IncludePaths[i]);\r
- strcat(sourceName, fileName);\r
- if(MS_FileExists(sourceName))\r
+ strcpy(sourceName, fileName);\r
+ foundfile = MS_FileExists(sourceName);\r
+ }\r
+ else\r
+ {\r
+ // Pascal 12/11/08\r
+ // Find the file in the include paths\r
+ for(i = 0; i < NumIncludePaths; i++)\r
{\r
- foundfile = TRUE;\r
- break;\r
+ strcpy(sourceName, IncludePaths[i]);\r
+ strcat(sourceName, fileName);\r
+ if(MS_FileExists(sourceName))\r
+ {\r
+ foundfile = TRUE;\r
+ break;\r
+ }\r
}\r
}\r
\r
tk_Token = TK_NONE;\r
AlreadyGot = FALSE;\r
\r
- // Pascal 11/12/08\r
+ // Pascal 12/11/08\r
// Set the first include path back to this file directory\r
SetLocalIncludePath(tk_SourceName);\r
\r