wrowe 01/06/17 22:08:46
Modified: file_io/win32 filepath.c
Log:
Normalize (forward slash) path gets on win32, and nip a bug that I need
to research further.
Revision Changes Path
1.6 +19 -4 apr/file_io/win32/filepath.c
Index: filepath.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/filepath.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- filepath.c 2001/05/16 03:42:35 1.5
+++ filepath.c 2001/06/18 05:08:44 1.6
@@ -138,6 +138,13 @@
if (!GetCurrentDirectory(sizeof(path), path))
return apr_get_os_error();
}
+ /* ###: We really should consider adding a flag to allow the user
+ * to have the APR_FILEPATH_NATIVE result
+ */
+ for (*rootpath = path; **rootpath; ++*rootpath) {
+ if (**rootpath == '\\')
+ **rootpath = '/';
+ }
*rootpath = apr_pstrdup(p, path);
return APR_SUCCESS;
}
@@ -165,7 +172,6 @@
return apr_get_os_error();
if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
return rv;
- *rootpath = apr_pstrdup(p, path);
}
else
#endif
@@ -178,8 +184,15 @@
drivestr[3] = '\0';
if (!GetFullPathName(drivestr, sizeof(path), path, &ignored))
return apr_get_os_error();
- *rootpath = apr_pstrdup(p, path);
}
+ /* ###: We really should consider adding a flag to allow the user
+ * to have the APR_FILEPATH_NATIVE result
+ */
+ for (*rootpath = path; **rootpath; ++*rootpath) {
+ if (**rootpath == '\\')
+ **rootpath = '/';
+ }
+ *rootpath = apr_pstrdup(p, path);
return APR_SUCCESS;
}
@@ -687,8 +700,10 @@
path[pathlen++] = ((flags & APR_FILEPATH_NATIVE) ? '\\' : '/');
}
- else if (!fixunc)
- path[pathlen++] = ((flags & APR_FILEPATH_NATIVE) ? '\\' : '/');
+ /* XXX: wrong, but gotta figure out what I intended;
+ * else if (!fixunc)
+ * path[pathlen++] = ((flags & APR_FILEPATH_NATIVE) ? '\\' : '/');
+ */
}
while (*addpath)