CliDispatch internal class.
@param {string} action The action name
@param {string} dir The directory name (relative path)
@param {string} baseDir The base directory name (absolute path)
499353
function CliDispatch (action, dir, baseDir) {
  this.action = action
  this.dir = dir
  this.baseDir = baseDir
}
1312166
function addActionCreator(path, actionMap, filePath) {

  const {node, parentPath} = path;
  if (node.arguments.length && parentPath.node && parentPath.node.id) {

    const action = parentPath.node.id.name;
    const firstArg = node.arguments[0];
    const actionType = firstArg.property ? firstArg.property.name : firstArg.name;

    const {loc} = parentPath.node
    actionMap[actionType] = actionMap[actionType] || createActionNode(actionType);
    actionMap[actionType].action = {name: action, path: `${filePath}#L${loc.start.line}-L${loc.end.line}`};
  }
}
542477
def run_callbacks(callback_name, action=nil)
      callbacks = self.class.send(:"#{callback_name}_callbacks")

      callbacks ||= []
      if action
        callbacks = filter_actions_by_only_exclude(callbacks || [], action)
      end

      begin
        callbacks.map { |v| v[0] }.each do |callback|
          case callback
          when Symbol
            send(callback)
          when Proc
            instance_eval(&callback)
          end
        end

        return false
      rescue StopChainException => e
        return true
      end
    end
254774
function Action(name) {
    Action.super_.call(this);
    this.id = ActionUniqueId();
    this.set('ActionID', this.id);
    this.set('Action', name);
}
206447
function searchFile(name, dirList, callback) {
  if (typeof dirList === 'function') {
    callback = dirList;
    dirList = '';
  }

  if (dirList === undefined) {
    dirList = ''
  }

  if (!Array.isArray(dirList)) {
    dirList = [dirList];
  }

  var success = dirList.some(function(dir) {
    if (!dir) {
      return false;
    }
    try {
      /**
       * Don't try to optimise this to be async since any failures will be
       * passed back to the caller:
       */

      var data = fs.readFileSync(path.join(dir, name), 'utf8');

      callback(null, data);
      return true;
    } catch (e) {
      return false;
    }
  });

  if (!success) {
    return callback('Failed to find file \'' + name + '\' at specified locations:' + dirList.join(','));
  }
}
668128
function deleteDefaultResourceAt(baseDir, resourceName) {
    shell.ls(path.join(baseDir, 'res/drawable-*'))
    .forEach(function (drawableFolder) {
        var imagePath = path.join(drawableFolder, resourceName);
        shell.rm('-f', [imagePath, imagePath.replace(/\.png$/, '.9.png')]);
        events.emit('verbose', 'Deleted ' + imagePath);
    });
}
301987
function (path, dir, cb) {
		var self = this;

		if (!cb) {
			cb = dir;
			dir = null;
		}

		fs.readdir(path, function (err, files) {
			if (err) return cb(err);

			var dirs = [];
			var routes = {};

			files.forEach(function (file) {
				if (file && file.match('.json')) {
					(dir) ? routes[file.replace('.json', '').toLowerCase()] = require(path + '/' + file) : routes[file.replace('.json', '').toLowerCase()] = require(self.routeFilePath(file)) ;
				} else if (file && file.match('.js')) {
					(dir) ? routes[file.replace('.js', '').toLowerCase()] = require(path + '/' + file) : routes[file.replace('.js', '').toLowerCase()] = require(self.routeFilePath(file)) ;
				} else {
					dirs.push(file);
				}
			});

			cb(null, { dirs: dirs, routes: routes, pathDir: path, rootApiPath: dir });
		});
	}
756282
function (basedir, filefn, dirfn) {
        filefn = filefn || function() {};
        dirfn = dirfn || function() {};

        var readdirSync = function(dir) {
            var files = fs.readdirSync(dir);

            for (var i = 0; i < files.length; i++) {
                var file = dir+'/'+files[i];
                //debug('before fs.statsSync:', file);
                var stats = fs.statSync(file);

                if (stats.isFile()) {
                var prefix = dir.replace(basedir, '');
                    filefn(prefix, dir, files[i], stats);

                } else if (stats.isDirectory()) {
                    var prefix = file.replace(basedir, '');
                    dirfn(prefix, stats);
                    readdirSync(file);

                } else {
                    console.error('error:'.error, 'It is a file type that is not assumed. file:', file);
                    return;
                }
            }
        };
        readdirSync(basedir);
    }
819210
private function process($srcFiles, $basedir)
    {
        // Log
        $this->log("Processing files with base directory ($basedir) ", $this->loglevel);
        $targets = [];
        if ($this->targetFilePos !== null) {
            $addedFiles = [];
            foreach ($srcFiles as $count => $file) {
                if ($this->mapper !== null) {
                    $subTargets = $this->mapper->main($file);
                    if ($subTargets !== null) {
                        foreach ($subTargets as $subTarget) {
                            if ($this->relative) {
                                $name = $subTarget;
                            } else {
                                $name = (new PhingFile($this->destDir, $subTarget))->getAbsolutePath();
                            }
                            if ($this->forwardslash && PhingFile::$separator !== '/') {
                                $name = str_replace(PhingFile::$separator, '/', $name);
                            }
                            if (!isset($addedFiles[$name])) {
                                $targets[] = $name;
                                $addedFiles[] = $name;
                            }
                        }
                    }
                }
            }
        }
        $targetFiles = $targets;

        if (!$this->addsourcefile) {
            $srcFiles = [];
        }
        $orig = $this->commandline->getCommandline();
        $result = []; // range(0,count($orig) + count($srcFiles) + count($targetFiles));

        $srcIndex = count($orig);
        if ($this->srcFilePos !== null) {
            $srcIndex = $this->srcFilePos->getPosition();
        }
        if ($this->targetFilePos !== null) {
            $targetIndex = $this->targetFilePos->getPosition();

            if ($srcIndex < $targetIndex || ($srcIndex === $targetIndex && $this->srcIsFirst)) {
                // 0 --> srcIndex
                $result[] = $orig;

                // srcIndex --> targetIndex
                $result += array_slice($orig, $srcIndex + count($srcFiles), $targetIndex - $srcIndex, true);

                $result[] = $orig;
                $result[] = $targetFiles;
                $result = array_merge(... $result);

                // targetIndex --> end
                $result = array_merge(
                    array_slice(
                        $orig,
                        $targetIndex + count($srcFiles) + count($targetFiles),
                        count($orig) - $targetIndex,
                        true
                    ),
                    $result
                );
            } else {
                // 0 --> targetIndex
                $result[] = $orig;
                $result[] = $targetFiles;
                $result = array_merge(... $result);

                // targetIndex --> srcIndex
                $result = array_merge(
                    array_slice(
                        $orig,
                        $targetIndex + count($targetFiles),
                        $srcIndex - $targetIndex,
                        true
                    ),
                    $result
                );

                // srcIndex --> end
                $result = array_merge(
                    array_slice(
                        $orig,
                        $srcIndex + count($srcFiles) + count($targetFiles),
                        count($orig) - $srcIndex,
                        true
                    ),
                    $result
                );
                $srcIndex += count($targetFiles);
            }
        } else { // no targetFilePos

            // 0 --> srcIndex
            $result = array_merge(array_slice($orig, 0, $srcIndex, true), $result);
            // srcIndex --> end
            $result = array_merge(
                array_slice($orig, $srcIndex + count($srcFiles), count($orig) - $srcIndex, true),
                $result
            );
        }
        // fill in source file names
        foreach ($srcFiles as $i => $file) {
            if ($this->relative) {
                $src = $file;
            } else {
                $src = (new PhingFile($basedir, $file))->getAbsolutePath();
            }
            if ($this->forwardslash && PhingFile::$separator !== '/') {
                $src = str_replace(PhingFile::$separator, '/', $src);
            }
            if ($this->srcFilePos !== null && ($this->srcFilePos->getPrefix() !== ''
                    || $this->srcFilePos->getSuffix() !== '')
            ) {
                $src = $this->srcFilePos->getPrefix() . $src . $this->srcFilePos->getSuffix();
            }
            $result[$srcIndex + $i] = $src;
        }

        $this->commandline = new Commandline(implode(' ', $result));
        $this->commandline->setEscape($this->escape);
        $this->realCommand = (string) $this->commandline . $this->additionalCmds;

        [$returncode, $output] = $this->executeCommand();

        $this->maybeSetReturnPropertyValue($returncode);

        // Sets the output property
        if ($this->outputProperty) {
            $previousValue = $this->project->getProperty($this->outputProperty);
            if (!empty($previousValue)) {
                $previousValue .= "\n";
            }
            $this->project->setProperty($this->outputProperty, $previousValue . implode("\n", $output));
        }

        // Validating the 'return-code'
        if ($this->checkreturn && ($returncode !== 0)) {
            $this->throwBuildException("Task exited with code ($returncode)");
        }
    }
483926
static function chdir($dir, $callback = null, $argv = array())
    {
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException("$dir does not exist.");
        }

        $cwd = getcwd();
        chdir($dir);

        if (null === $callback) {
            return;
        }

        $returnValue = call_user_func_array($callback, $argv);

        chdir($cwd);
        return $returnValue;
    }
1273901
function callMiddlewares(actionName, actionData, done) {
    let store = this;
    let index = -1;
    /**
     * Call next middleware or done
     * @function next
     * @param {*} actionData - An action data
     */
    function next(actionData) {
        index++;
        if(index === store.middlewares.length) {
            done(actionData);
        } else {
            store.middlewares[index](store, actionName, actionData, next);
        }
    }
    next(actionData);
}
789764
function addActionBtn( id, res ) {
  log( 'addActionBtn', "start");
  var html = "";
  for( var x = 0; x < res.actions.length; x++ ) {
    var action = res.actions[x];
    var name = "help";
    var txt = "?";
    var icon = "ui-iocon-help";
    var jscall = "help";
    if ( action.actionName == "fullWidth" ) {
      name = "fullWidth";
      txt = "Full width";
      icon = "ui-icon-arrow-2-e-w";
      jscall = "resViewFullWidth( \""+id+"\" );";
      html += "<button id=\""+id+name+"Bt\">"+ $.i18n( txt )+"</button>";
      html += "<script>  $(function() { $( \"#"+id+name+"Bt\" ).button( { icons:{primary: \""+icon+"\"}, text: false } ).click( "+
        "function() { "+jscall+" }); }); </script>";    

    } else if ( action.actionName == "fullScreen" ) {
      name = "fullScreen";
      txt = "Full screen";
      icon = "ui-icon-arrow-4-diag";
      jscall = "resViewFullScreen( \""+id+"\" );";
      html += "<button id=\""+id+name+"Bt\">"+ $.i18n( txt )+"</button>";
      html += "<script>  $(function() { $( \"#"+id+name+"Bt\" ).button( { icons:{primary: \""+icon+"\"}, text: false } ).click( "+
        "function() { "+jscall+" }); }); </script>";    
    } 

    // hook for generating action button code
    log( 'addActionBtn', "addActionBtn "+action.type );
    hook = getHookMethod( "addActionBtn", action.type );
    if ( hook != "" ) {
      log( 'addActionBtn', hook+"( "+action.actionName+" )");
      html += eval( hook+"( id, action.actionName, res.resourceURL, action.param )" );
      dlgMap.push( [ id, action.actionName, res.resourceURL, action.type, action.param ] );
    }
  }
  return html;
}
555875
function(paths) {
    return (
        gulp
        .src(paths.src.path)
        .pipe(gulp.dest(paths.output.baseDir))
    );
}
1235015
function(root, dirs, fn) {

    if(dirs.length > 0) {

        var dir = NX.Path.normalize(root + '/' + dirs.join('/') + '/');
        var file = dir + 'extent.action.js';

        NX.Path.exists(file, function(exists) {

            if(!exists) {
                dirs.pop();
                checkExtentActionFile(root, dirs, fn);
            } else {
                fn({
                    type: 'extent',
                    path: file
                });
            }

        });

    } else {
        fn();
    }

}
36603
def auto_set_dir(action=None, name=None):
    
    mod = sys.modules['__main__']
    basename = os.path.basename(mod.__file__)
    auto_dirname = os.path.join('train_log', basename[:basename.rfind('.')])
    if name:
        auto_dirname += '_%s' % name if os.name == 'nt' else ':%s' % name
    set_logger_dir(auto_dirname, action=action)
1085482
public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
        Properties props = new Properties();
        File extra = new File(baseDir, EXTRA_HEADERS_FILE);
        extra.getParentFile().mkdirs();
        // If the file exist it loads it, if not nothing happens.
        props = Instructions.merge(props, extra);
        if (value != null) {
            props.setProperty(header, value);
        } else {
            props.remove(header);
        }
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(extra);
            props.store(fos, "");
        } finally {
            IOUtils.closeQuietly(fos);
        }
    }
829020
function buildImportPath(directory, target, baseUrl) {
    // If the base URL option is set then imports should be relative to there.
    const startLocation = baseUrl ? baseUrl : directory.path;
    const relativePath = path_1.default.relative(startLocation, target.path);
    // Get the route and ensure it's relative
    let directoryPath = path_1.default.dirname(relativePath);
    if (directoryPath !== ".") {
        directoryPath = `.${path_1.default.sep}${directoryPath}`;
    }
    // Strip off the .ts or .tsx from the file name.
    const fileName = getBasename(relativePath);
    // Build the final path string. Use posix-style seperators.
    const location = `${directoryPath}${path_1.default.sep}${fileName}`;
    const convertedLocation = utilities_1.convertPathSeparator(location);
    return stripThisDirectory(convertedLocation, baseUrl);
}