summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2005-03-31 23:02:20 (GMT)
committerMarcus Boerger <helly@php.net>2005-03-31 23:02:20 (GMT)
commit7adb2b0c0b4cd98b6e1b0c29043867ae6c458ac2 (patch)
tree22cdd89329464d86ab4bec159cf559515a726ded /ext
parentd383735978c791a961e658e8c39100c2af57f875 (diff)
downloadphp-7adb2b0c0b4cd98b6e1b0c29043867ae6c458ac2.tar.gz
- Add RecursiveDirectoryIterator::getSubPathname()
Diffstat (limited to 'ext')
-rwxr-xr-xext/spl/spl_directory.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index a8eb635..93f5a4c 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -564,7 +564,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
}
/* }}} */
-/* {{{ proto void RecursiveDirectoryIterator::rewind()
+/* {{{ proto void RecursiveDirectoryIterator::getSubPath()
Get sub path */
SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
{
@@ -579,6 +579,24 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
}
/* }}} */
+/* {{{ 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 @@ static zend_function_entry spl_ce_dir_tree_class_functions[] = {
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}
};