checkWorkingDir - Checking that the working directory exists and is a directory.

@param  {string} workingDir Path to the working directory
@param  {function} cb
486975
function checkWorkingDir(workingDir, cb) {
  fs.stat(workingDir, function(err, stats) {
    var errMessage;
    if (err) {
      errMessage = "The directory " + workingDir + " does not exist.";
      logger.error(errMessage);
      return cb(errMessage);
    }

    //Checking that it is a directory
    if (!stats.isDirectory()) {
      errMessage = "Expected " + workingDir + " to be a directory";
      logger.error(errMessage);
      return cb(errMessage);
    }

    return cb();
  });
}
5631
function cb (err) {
    if (cb.done) return
    cb.done = true
    if (err) {
      log.warn('install', 'got an error, rolling back install')
      // roll-back the install if anything went wrong
      gyp.commands.remove([ release.versionDir ], function () {
        callback(err)
      })
    } else {
      callback(null, release.version)
    }
  }
645211
@Override
	public void setWorkingDirectory(String workingDir) {
		this.workingDir = workingDir;
		if (!this.workingDir.endsWith(URL_SEPARATOR)) {
			this.workingDir = this.workingDir + URL_SEPARATOR;
		}
	}
821527
function makeme (dir,mode,cb){

    var callback = function(err,parent){
        //console.log('makeme: ',dir)
        if(err) throw new Error(err)
        if(parent){
            // replace root of dir with parent
            dir = path.join(parent,path.basename(dir));
        }
        fs.mkdir(dir,mode,function(err){
            if(err !== null){
                if( err.code === 'EEXIST'
                 && err.path === dir){
                    // make sure the directory really does exist
                    fs.stat(dir,function(staterr,stat){
                        // as mkdirP guys say, this is very strange
                        if(staterr || !stat.isDirectory()){
                            if(cb) cb(err);
                        }
                        if(cb) cb(null,dir);
                        return null;
                        // if the stat is good, do nothing.  some other processed did it
                    });

                }else{
                    console.log(err);
                    throw new Error(err);
                }
            }else{
                if(cb) cb(null,dir);
            }
            return 1;

        });
    };
    return callback;
}
930534
def step_a_new_working_directory(context):
    
    command_util.ensure_context_attribute_exists(context, "workdir", None)
    command_util.ensure_workdir_exists(context)
    shutil.rmtree(context.workdir, ignore_errors=True)
1353049
function _ensureExists(dir, callback) {
    dir = path.resolve(dir); // make full path
    
    path.exists(dir, function(exists) {
        if (!exists) {
            // ensure that the parent dir exists
            _ensureExists(path.dirname(dir), function(err) {
                if (err) {
                    callback(err);
                    return;
                }
                
                // make the dir
                log.log('Creating ' + dir);
                fs.mkdir(dir, function(err) {
                    if (err) {
                        callback(err);
                        return;
                    }
                    
                    callback(null);
                });
            });
        }
        else {
            callback(null);
        }
    });
}
1097173
def working_directory(self):
        
        if self.chroot_directory and not \
                self._working_directory.startswith(self.chroot_directory):
            return self.chroot_directory + self._working_directory
        else:
            return self._working_directory
765223
function(callback) {
      fs.readdir(args['<directory>'], function(err, files) {
        // error here means it does not exist, which is good.
        if (err || args['--force']) {
          return callback(null, args['<directory>']);
        }
        if (files.length > 0) {
          return callback(new Error(format('destination '
            + 'directory %s is not empty.', path.resolve(args['<directory>']))));
        }
        return callback(null, args['<directory>']);
      });
    }
481067
function checkSubmissionDir (mode, callback) {
  var exercise = this

  exercise.submission = this.args[0] // submission first arg obviously


  function failBadPath () {
    exercise.emit('fail', 'Submitted a readable directory path (please supply a path to your solution)')
    callback(null, false)
  }

  if (!exercise.submission)
    return failBadPath()

  fs.stat(exercise.submission, function (err, stat) {
    if (err)
      return failBadPath()

    if (!stat.isDirectory())
      return failBadPath()

    callback(null, true)
  })
}
855115
async function archiveWorkingDir(dirPath, archive) {
  // recursively collect all entries (files and directories)
  const allEntries = await collectFSEntries(dirPath, []);

  const process = (entry, cb) => {
    const p = relativePaths(dirPath, entry.path);
    if (p.length) {
      if (entry.stats.isDirectory()) {
        archive.append(null, { name: `${p}/` });
      } else {
        archive.append(fse.createReadStream(entry.path), { name: p });
      }
    }
    cb();
  };

  return new Promise((resolve, reject) => {
    async.eachSeries(
      allEntries,
      process,
      (err) => {
        if (err) {
          reject(err);
        } else {
          resolve(archive);
        }
      },
    );
  });
}
1152435
function(options){
        if (!options) {
            options = {
                cwd: workingDirectory
            };

            return options;
        } else {
            workingDirectory = options.cwd;
            return options;
        }
    }
214462
def set_current_client_working_directory(self, directory):
        """"""
        shellwidget = self.get_current_shellwidget()
        if shellwidget is not None:
            shellwidget.set_cwd(directory)
327707
function _isDirectory (directory, callback) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" === typeof callback) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				lstat(directory, (err, stats) => {
					return callback(null, Boolean(!err && stats.isDirectory()));
				});

			}

		}
1367336
public boolean addWorkingDir(String dirName) {
        if (dirName == null) {
            throw new NullPointerException();
        }
        return addToListInternal(currentWorkingDirectoryList, new File(dirName));
    }
238902
function readDirs(dir, cb)  {
  // find top-level module dirs
  if (Array.isArray(dir)) {
    // dir is a list of paths
    readDirsParallel(dir, cb);
  } else {
    // dir is a single path value
    readDirAbs(dir, cb);
  }
}
682886
function checkParentNodeModules(cb) {
    parentNodeModules = getParentNodeModules();

    // Check if a node_modules folder exists in any folder from the one above.
    // to top /.
    if (parentNodeModules.length) {
        let str;
        str = 'A "node_modules" folder was detected in ';
        str += parentNodeModules.length === 1 ? 'a parent directory: ' :
            'these parent directories: ';
        warn(str);
        parentNodeModules.forEach(dir => logList(dir));
        log();

        str = 'If you continue, ' + (parentNodeModules.length === 1 ?
                                     'that folder' : 'those folders');
        log(str + ' will be temporarily renamed. This');
        log('might affect only live node processes. If unsure, choose No ');
        log('and try to install nodeGame on another path.');
        log();
        if (!yes) {
            confirm('Continue? [y/n]', function(ok) {
                if (ok) {
                    log();
                    let res = renameParentNodeModules(parentNodeModules);
                    if (res !== true) {
                        err('Could not rename ' + res[0]);
                        installationFailed();
                    }
                    log();
                    doInstall();
                }
                else {
                    installationAborted(true);
                    return;
                }
            });
        }
        else {
            log('Continue? [y/n] --yes');
            log();
        }
    }
    else {
        doInstall();
    }
}
365238
def change_to_workdir(self):
        
        logger.info("Changing working directory to: %s", self.workdir)

        self.check_dir(self.workdir)
        try:
            os.chdir(self.workdir)
        except OSError as exp:
            self.exit_on_error("Error changing to working directory: %s. Error: %s. "
                               "Check the existence of %s and the %s/%s account "
                               "permissions on this directory."
                               % (self.workdir, str(exp), self.workdir, self.user, self.group),
                               exit_code=3)
        self.pre_log.append(("INFO", "Using working directory: %s" % os.path.abspath(self.workdir)))