Change directory for script if necessary.
974990
def setup_dir(self):
        """"""
        cd = self.opts.cd or self.config['crony'].get('directory')
        if cd:
            self.logger.debug(f'Adding cd to {cd}')
            self.cmd = f'cd {cd} && {self.cmd}'
360200
def do_mkdir(self, path):
        """"""
        path = path[0]

        self.n.makeDirectory(self.current_path + path)
        self.dirs = self.dir_complete()
942751
def run_script(dist_spec, script_name):
    """"""
    ns = sys._getframe(1).f_globals
    name = ns['__name__']
    ns.clear()
    ns['__name__'] = name
    require(dist_spec)[0].run_script(script_name, ns)
317354
def ensure_dir_does_not_exist(*args):
    """"""
    path = os.path.join(*args)
    if os.path.isdir(path):
        shutil.rmtree(path)
1187667
def _ensure_directory(path):
    """"""
    dirname = os.path.dirname(path)
    if not os.path.isdir(dirname):
        os.makedirs(dirname)
1132171
def make_dir(cls, directory_name):
        """"""
        if not os.path.exists(directory_name):
            os.makedirs(directory_name)
578848
private void changeDirectoryPermissions(String dir, String mode, 
                                              boolean isRecursive) {
    int ret = 0;
    try {
      ret = FileUtil.chmod(dir, mode, isRecursive);
    } catch (Exception e) {
      LOG.warn("Exception in changing permissions for directory " + dir + 
                  ". Exception: " + e.getMessage());
    }
    if (ret != 0) {
      LOG.warn("Could not change permissions for directory " + dir);
    }
  }
1131414
def _options_dir(name):
    '''
    
    '''
    _check_portname(name)
    _root = '/var/db/ports'

    # New path: /var/db/ports/category_portname
    new_dir = os.path.join(_root, name.replace('/', '_'))
    # Old path: /var/db/ports/portname
    old_dir = os.path.join(_root, name.split('/')[-1])

    if os.path.isdir(old_dir):
        return old_dir
    return new_dir
640241
public void goUpDir() throws IOException, ServerException {
        try {
            controlChannel.execute(Command.CDUP);
            // alternative: changeDir("..");
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Server refused changing current directory");
        }
    }
1345750
def O
      dir = current_item.directory? ? current_item.path : current_dir.path
      system %Q[osascript -e 'tell app "Terminal"
        do script "cd #{dir}"
      end tell'] if osx?
    end
1060033
def do__relative_load(self, args: argparse.Namespace) -> None:
        """"""
        file_path = args.file_path
        # NOTE: Relative path is an absolute path, it is just relative to the current script directory
        relative_path = os.path.join(self._current_script_dir or '', file_path)
        self.do_load(relative_path)
1109939
def ensure_dir(filename):
    """"""
    directory = os.path.dirname(filename)
    if directory and not os.path.isdir(directory):
        os.makedirs(directory)
1064959
def _ensure_directory_exists(self, directory):
        """"""
        if not os.path.lexists(directory):
            os.makedirs(directory)
        return directory
1029630
def change_dir(newdir):
    
    prevdir = os.getcwd()
    os.chdir(os.path.expanduser(newdir))
    try:
        yield
    finally:
        os.chdir(prevdir)
1280840
def set_dir(self, dir_):
        """"""

        self.__lock_set_dir(dir_)
        self.__lock_auto_load()
        self.__lock_update_table()
        self.__update_info()
        self.__update_window_title()
33568
def ensure_dir_exists(path):
    """"""

    import os

    f_dir = os.path.dirname(path)

    if not os.path.exists(f_dir):
        os.makedirs(f_dir)

    return f_dir
1347118
def change_dir():
    """"""
    try:
        d = os.environ['HADOOPY_CHDIR']
        sys.stderr.write('HADOOPY: Trying to chdir to [%s]\n' % d)
    except KeyError:
        pass
    else:
        try:
            os.chdir(d)
        except OSError:
            sys.stderr.write('HADOOPY: Failed to chdir to [%s]\n' % d)