Registers a directory where to look for modules.

        By default only modules relative to current path are found.
324822
def register_path(self, path):
        
        self._paths.insert(0, os.path.abspath(path))
1146926
def register(self, path):
        
        if path not in self._paths:
            LOG.debug('%r: registering %r', self, path)
            self._paths.add(path)
120989
protected function calculateModulePath()
    {
        if (!$this->module || '/' == $this->module) {
            $this->modulePath = APP_ROOT;
        } else {
            if (isset($this->modules[$this->module]) && isset($this->modules[$this->module]['path'])) {
                $this->modulePath = $this->modules[$this->module]['path'];
            } else {
                $this->modulePath = APP_ROOT . 'modules' . DIRECTORY_SEPARATOR . $this->module . DIRECTORY_SEPARATOR;
            }
        }
    }
501117
function isModuleDirectory(filePath) {
  try {
    const manifestPath = path.join(filePath, MANIFEST);
    if (fs.statSync(manifestPath).isFile()) {
      const module = require(manifestPath);
      return module && module.main;
    }
  } catch (error) {}
}
1371681
private List<File> locateModules() {
    File[] files = modRoot.listFiles();
    List<File> modFiles = new ArrayList<>();
    for (File file : files) {
      if (file.isDirectory()) {
        // Check to determine whether the directory is a valid module directory.
        boolean isValid = true;
        try {
          new ModuleIdentifier(file.getName());
        } catch (Exception e) {
          isValid = false;
        }

        // If the directory is a valid module name then check for a mod.json file.
        if (isValid) {
          File modJson = new File(file, MOD_JSON_FILE);
          if (modJson.exists()) {
            modFiles.add(file);
          }
        }
      }
    }
    return modFiles;
  }
1226015
function findDirRec(dir, callback) {
      var result = path.resolve(dir, dirmod);
      fs.stat(result, function stat(err, stat) {
        if (err || !stat.isDirectory()) {
          if (lastResult == result) {
            callback(new Error('No configuration directory found.'));
            return;
          }
          lastResult = result;
          findDirRec(path.resolve(dir, '..'), callback);
        } else {
          callback(null, result);
        }
      });
    }
1353563
protected function registerAspectModule()
    {
        if (isset($this->configure['modules'])) {
            foreach ($this->configure['modules'] as $module) {
                $this->register($module);
            }
        }
    }
1038913
function registerModules() {
    // Dynamic module loading is no longer supported for simplicity.
    // Module is free to load any of its resources dynamically.
    // Or an extension can provide dynamic module loading capabilities as needed.
    if (_scalejs2.default.isApplicationRunning()) {
        throw new Error('Can\'t register module since the application is already running.', 'Dynamic module loading is not supported.');
    }

    Array.prototype.push.apply(moduleRegistrations, toArray(arguments).filter(function (m) {
        return m;
    }));
}
1295882
def isdir(path, **kwargs):
    """"""
    import os.path
    return os.path.isdir(path, **kwargs)
1221141
public function registerDirectories()
    {
        // Publish config files
        $this->publishes([
             __DIR__.'/../config' => config_path('decoy')
        ], 'config');

        // Publish decoy css and js to public directory
        $this->publishes([
            __DIR__.'/../dist' => public_path('assets/decoy')
        ], 'assets');

        // Publish lanaguage files
        $this->publishes([
            __DIR__.'/../lang' => resource_path('lang/vendor/decoy')
        ], 'lang');

        // Register views
        $this->loadViewsFrom(__DIR__.'/../views', 'decoy');

        // Load translations
        $this->loadTranslationsFrom(__DIR__.'/../lang', 'decoy');

        // Load migrations
        $this->loadMigrationsFrom(__DIR__.'/../migrations/');
    }
92975
function loadModules(rootDir, paths) {
        var serverModules = {};
        var me = this;

        // return empty object if no rootDir or paths
        if (!rootDir || !paths) { return serverModules; }

        // loop through paths and load all modules in those directories
        _.each(paths, function (relativePath) {
            var fullPath = path.normalize(rootDir + delim + relativePath);

            // if the directory doesn't exist, then skip to the next loop iteration
            if (fs.existsSync(fullPath)) {

                _.each(fs.readdirSync(fullPath), function (fileName) {

                    // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping
                    if (utils.isJavaScript(fileName) && !fileName.match(/^.*\.service\.js$/)) {
                        var nameLower = utils.getCamelCase(fileName).toLowerCase();
                        var fullFilePath = path.normalize(fullPath + '/' + fileName);

                        // there are 2 diff potential aliases for any given server module
                        serverModules[nameLower + 'fromplugin'] = serverModules[nameLower] = require(fullFilePath);
                    }

                    // else if we are dealing   with a directory, recurse down into the folder
                    else if (fs.lstatSync(path.join(fullPath, fileName)).isDirectory()) {
                        _.extend(serverModules, me.loadModules(rootDir, [relativePath + '/' + fileName]));
                    }

                });
            }
        });

        return serverModules;
    }
1183871
def register_schema(self, directory, path):
        
        self.schemas[path] = os.path.abspath(directory)
180925
def ensure_dir_path(self, path, relative=False):
        
        if not relative:
            rel_path = self.relpath(path)
        else:
            rel_path = path

        # Locator
        if self.is_locator(rel_path, relative=True):
            path = path.rstrip('/')

        # Directory
        elif rel_path:
            path = path.rstrip('/') + '/'
        # else: root
        return path
1130773
function listModulesInDirectory(modulesDir) {
    const log = debug('phantomas:modules');
    log('Getting the list of all modules in ' + modulesDir);

    // https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options
    var ls = fs.readdirSync(modulesDir),
        modules = [];

    ls.forEach(function(entry) {
        // First check whether an entry is a directory, than check if it contains a module file
        // https://nodejs.org/api/fs.html#fs_fs_existssync_path
        if (fs.existsSync(modulesDir + '/' + entry + '/' + entry + '.js')) {
            modules.push(entry);
        }
    });

    return modules.sort();
}
916233
function ModuleDef (path) {
      this.path = path;
      this.friendlyPath = path;

      util.splitPath(path, this);
      this.directory = util.resolve(ENV.getCwd(), this.directory);
    }
1371993
def _check_module(folder):
        
        if not folder.exists():
            folder.mkdir(parents=True, exist_ok=True, mode=0o755)
            (folder / '__init__.py').touch()
45423
private function registerModule($module, $dir)
    {
        $parentModuleFile = $this->jsDir.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$this->getParentModuleFile($dir).".js";

        if (!file_exists($parentModuleFile)) {
            return;
        }
        
        $fileContent = file_get_contents($parentModuleFile);

        $fileContent = str_replace('/*@modules*/', ",'".$module."'\n            /*@modules*/", $fileContent);

        file_put_contents($parentModuleFile, $fileContent);
    }