helly Thu Mar 31 18:02:20 2005 EDT
Modified files:
/php-src/ext/spl spl_directory.c
Log:
- Add RecursiveDirectoryIterator::getSubPathname()
http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.40&r2=1.41&ty=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.40
php-src/ext/spl/spl_directory.c:1.41
--- php-src/ext/spl/spl_directory.c:1.40 Thu Mar 31 16:51:45 2005
+++ php-src/ext/spl/spl_directory.c Thu Mar 31 18:02:20 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.40 2005/03/31 21:51:45 helly Exp $ */
+/* $Id: spl_directory.c,v 1.41 2005/03/31 23:02:20 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -564,7 +564,7 @@
}
/* }}} */
-/* {{{ proto void RecursiveDirectoryIterator::rewind()
+/* {{{ proto void RecursiveDirectoryIterator::getSubPath()
Get sub path */
SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
{
@@ -579,6 +579,24 @@
}
/* }}} */
+/* {{{ proto void RecursiveDirectoryIterator::getSubPathname()
+ Get sub path and file name */
+SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
+{
+ zval *object = getThis();
+ spl_ce_dir_object *intern =
(spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
+ char *sub_name;
+ int len;
+
+ if (intern->sub_path) {
+ len = spprintf(&sub_name, 0, "%s/%s", intern->sub_path,
intern->entry.d_name);
+ RETURN_STRINGL(sub_name, len, 0);
+ } else {
+ RETURN_STRING(intern->entry.d_name, 1);
+ }
+}
+/* }}} */
+
/* define an overloaded iterator structure */
typedef struct {
zend_object_iterator intern;
@@ -848,6 +866,7 @@
SPL_ME(RecursiveDirectoryIterator, hasChildren, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getSubPath, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(RecursiveDirectoryIterator, getSubPathname,NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php