summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-02-02 15:10:04 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-02-02 15:10:04 +0000
commit0c972edce473566e72ffb82867121b9cfaae4543 (patch)
tree76747d5b06fd5eda2ca4ff663d846b3f9085e05c /ext
parent0655132e2c5e93ea678962126952cd523691c424 (diff)
downloadphp-git-0c972edce473566e72ffb82867121b9cfaae4543.tar.gz
Only use win32 directory separators on win32 or netware.
Diffstat (limited to 'ext')
-rwxr-xr-xext/spl/spl_directory.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index bf44cddc65..4ef272456b 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -176,7 +176,11 @@ static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path TS
intern->path_len = strlen(path);
intern->u.dir.dirp = php_stream_opendir(path, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
- if (intern->path_len && (path[intern->path_len-1] == '/' || path[intern->path_len-1] == '\\')) {
+ if (intern->path_len && (path[intern->path_len-1] == '/'
+#if defined(PHP_WIN32) || defined(NETWARE)
+ || path[intern->path_len-1] == '\\'
+#endif
+ )) {
intern->path = estrndup(path, --intern->path_len);
} else {
intern->path = estrndup(path, intern->path_len);
@@ -279,7 +283,11 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path,
intern->file_name_len = len;
p1 = strrchr(path, '/');
+#if defined(PHP_WIN32) || defined(NETWARE)
p2 = strrchr(path, '\\');
+#else
+ p2 = 0;
+#endif
if (p1 || p2) {
intern->path_len = (p1 > p2 ? p1 : p2) - path;
} else {
@@ -1397,7 +1405,11 @@ SPL_METHOD(SplFileObject, __construct)
if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == SUCCESS) {
p1 = strrchr(intern->file_name, '/');
- p2 = strrchr(intern->file_name, '\\');
+#if defined(PHP_WIN32) || defined(NETWARE)
+ p2 = strrchr(path, '\\');
+#else
+ p2 = 0;
+#endif
if (p1 || p2) {
intern->path_len = (p1 > p2 ? p1 : p2) - intern->file_name;
} else {