You are here

function _module_builder_check_settings in Module Builder 7

Same name and namespace in other branches
  1. 5 module_builder.module \_module_builder_check_settings()
  2. 6.2 includes/common.inc \_module_builder_check_settings()

Create a directory to store hook files if it does not exist.

This logic blatantly ripped off from image.module -- thanks James! :) // somewhat obsolete.

3 calls to _module_builder_check_settings()
module_builder_admin_update_submit in includes/module_builder.admin.inc
Admin hook update form submit handler.
module_builder_page in includes/module_builder.pages.inc
Xmodule_builder_page_input in ./module_builder.module
Module form: 'input' step. Collect module data.

File

includes/common.inc, line 97
common.inc Stuff needed both by module and drush command.

Code

function _module_builder_check_settings($directory = NULL) {
  if ($directory) {

    // on drush
    if (!is_dir($directory)) {
      mkdir($directory);
    }
  }
  else {

    // on module
    // sanity check. need to verify /files exists before we do anything. see http://drupal.org/node/367138
    $files = file_create_path();
    file_check_directory($files, FILE_CREATE_DIRECTORY);

    // check hooks directory exists or create it
    $hooks_path = file_create_path(variable_get('module_builder_hooks_directory', 'hooks'));
    file_check_directory($hooks_path, FILE_CREATE_DIRECTORY, 'module_builder_hooks_directory');
  }
}