Fixed gmxcpp to always use unix path separators in internal names (just like cpp)
authorErik Lindahl <lindahl@cbr.su.se>
Fri, 27 Aug 2010 17:45:07 +0000 (19:45 +0200)
committerErik Lindahl <lindahl@cbr.su.se>
Fri, 27 Aug 2010 17:45:07 +0000 (19:45 +0200)
src/gmxlib/gmxcpp.c
src/kernel/pdb2top.c

index ab17cbd60175dcff89dcf6140dd4b75f090cb904..0cb6fb7c5bc2c6835efd0aa41cb215bd5ea27c23 100644 (file)
@@ -186,7 +186,7 @@ int cpp_open_file(const char *filenm,gmx_cpp_t *handle, char **cppopts)
   char *ptr;
   int i;
   unsigned int i1;
-  
+    
   /* First process options, they might be necessary for opening files
      (especially include statements). */  
   i  = 0;
@@ -232,7 +232,7 @@ int cpp_open_file(const char *filenm,gmx_cpp_t *handle, char **cppopts)
       sprintf(buf, "%s%c%s", incl[i], DIR_SEPARATOR, filenm);
       if (gmx_fexist(buf))
       {
-        cpp->fn = buf;
+          cpp->fn = buf;
         break;
       }
       sfree(buf);
@@ -248,8 +248,10 @@ int cpp_open_file(const char *filenm,gmx_cpp_t *handle, char **cppopts)
     gmx_fatal(FARGS, "Topology include file \"%s\" not found", filenm);
   }
   /* If the file name has a path component, we need to change to that
-   * directory. */
-  ptr = strrchr(cpp->fn, DIR_SEPARATOR);
+   * directory. Note that we - just as C - always use UNIX path separators
+   * internally in include file names.
+   */
+  ptr = strrchr(cpp->fn, '/');
   if (!ptr)
   {
     cpp->path = NULL;
@@ -261,7 +263,7 @@ int cpp_open_file(const char *filenm,gmx_cpp_t *handle, char **cppopts)
     *ptr      = '\0';
     cpp->fn   = strdup(ptr+1);
     snew(cpp->cwd,STRLEN);
-
+      
 #if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
       pdum=_getcwd(cpp->cwd,STRLEN);
       _chdir(cpp->path);
index 315beeeed2f7b3bd2eb50341b77b920c14d8c5b5..816ff4ca32afead6767369484fc9d6fa3501e209 100644 (file)
@@ -223,7 +223,7 @@ choose_ff(const char *ffsel,
             if(cwdsel!=-1)
             {
                 fprintf(stderr,
-                        "Note: Force field '%s' occurs in %d places, using version from current directory.\n"
+                        "Force field '%s' occurs in %d places, reading from current directory.\n"
                         "Use interactive selection (not the -ff option) if you prefer a different one.\n",
                         ffsel,nfound);
             }