file_directory_path

Versions
4.7 – 6
file_directory_path()
7
file_directory_path($scheme = NULL)

Determines the local directory path of a given wrapper.

This function will return the directory path of a stream wrapper. A stream is referenced as: "scheme://target". For example, a scheme of "public" might return "sites/default/files" or "temporary" might return "/tmp".

Parameters

$scheme A string representing the scheme of a stream. The default wrapper is is assumed if this is not provided.

Return value

A string containing the directory path of a stream. FALSE is returned if the scheme is invalid or a wrapper could not be instantiated.

Related topics

▾ 16 functions call file_directory_path()

drupal_get_css in includes/common.inc
Returns a themed representation of all stylesheets that should be attached to the page.
drupal_get_js in includes/common.inc
Returns a themed presentation of all JavaScript code for the current page.
image_install in modules/image/image.install
Implement hook_install().
image_uninstall in modules/image/image.install
Implement hook_uninstall().
simpletest_generate_file in modules/simpletest/simpletest.install
Generate test file.
simpletest_run_tests in modules/simpletest/simpletest.module
Actually runs tests.
simpletest_uninstall in modules/simpletest/simpletest.install
Implement hook_uninstall().
system_file_system_settings in modules/system/system.admin.inc
Form builder; Configure the site file handling.
system_retrieve_file in modules/system/system.module
Attempts to get a file using drupal_http_request and to store it locally.
system_theme_settings in modules/system/system.admin.inc
Form builder; display theme configuration for entire site and individual themes.
update_manager_file_get in modules/update/update.manager.inc
Copies a file from $url to the temporary directory for updates.
upload_form_alter in modules/upload/upload.module
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.
_drupal_bootstrap_full in includes/common.inc
_file_generic_settings_file_directory_validate in modules/file/file.field.inc
Element validate callback for the file destination field.
_update_manager_extract_directory in modules/update/update.manager.inc
Return the directory where update archive files should be extracted.

Code

includes/file.inc, line 1660

<?php
function file_directory_path($scheme = NULL) {
  if (empty($scheme)) {
    $scheme = variable_get('file_default_scheme', 'public');
  }
  if ($wrapper = file_stream_wrapper_get_instance_by_scheme($scheme)) {
    return $wrapper->getDirectoryPath();
  }
  else {
    return FALSE;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.