public static function chroot(string $path='/', bool $override = false) {

    	// this is now deprecated, will probably be removed in a future release
		trigger_error(
			'Usage of Polyfony\Filesystem is deprecated, require symfony/filesystem instead', 
			E_USER_DEPRECATED
		);

        // if chrooting is enabled in the configuration
        if(Config::get('filesystem', 'chroot') && !$override) {
            // if the path already has the proper (ch)root
            if(strpos($path, Config::get('filesystem', 'data_path')) === 0) {
                // remove the root, remove double dots
                $path = str_replace(array(Config::get('filesystem', 'data_path'), '..'), '', $path);
                // re-add the root
                return(Config::get('filesystem', 'data_path') . $path);
            }
            // the path doesn't start with the (ch)root
            else {
                // remove all double dots and add the root path
                return(Config::get('filesystem', 'data_path') . str_replace('..','',$path));
            }
        }
        // return the path (altered or not)
        return($path);

    }