diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e555e50b4db..4240cd0ec45 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3229,6 +3229,17 @@ function dol_readcachefile($directory, $filename) return $object; } +/** + * Return the relative dirname (relative to DOL_DATA_ROOT) of a full path string. + * + * @param string $pathfile Full path of a file + * @return string Path of file relative to DOL_DATA_ROOT + */ +function dirbasename($pathfile) +{ + return preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'\//', '', $pathfile); +} + /** * Function to get list of updated or modified files.