find a ``DirEntry`` located at *path*. Returns ``None`` if path
        does not exist.
180640
def find(self, path):
        

        if isinstance(path, DirEntry):
            return path

        if path == "/":
            return self.root

        split_path = path.lstrip('/').split("/")

        i = 0
        root = self.root

        while True:

            children = self.listdir_dict(root)
            match = children.get(split_path[i], None)

            if match:
                if i == len(split_path) - 1:
                    return match
                root = match
                i += 1
            else:
                return None
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);
        }
      });
    }
317779
def _checkpath(self, path):
        
        if path.startswith("/") or ".." in path or path.strip() != path:
            raise NotFoundException()
844474
def abspath(*path):
    """"""
    setup_dir = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(setup_dir, *path)
935554
def get_src_or_dst_path(prompt, count):
    
    _path = ""
    print(prompt)
    option = input("Option: ")
    print("\n")
    if option == '1':
        # Set the path to the system desktop folder.
        logger_directory.info("1: desktop")
        _path = os.path.expanduser('~/Desktop')
    elif option == '2':
        # Set the path to the system downloads folder.
        logger_directory.info("2: downloads")
        _path = os.path.expanduser('~/Downloads')
    elif option == '3':
        # Current directory
        logger_directory.info("3: current")
        _path = os.getcwd()
    elif option == '4':
        # Open up the GUI browse dialog
        logger_directory.info("4: browse ")
        _path = browse_dialog_dir()

    else:
        # Something went wrong. Prompt again. Give a couple tries before defaulting to downloads folder
        if count == 2:
            logger_directory.warn("too many attempts")
            print("Too many failed attempts. Defaulting to current working directory.")
            _path = os.getcwd()
        else:
            count += 1
            logger_directory.warn("failed attempts: {}".format(count))
            print("Invalid option. Try again.")

    return _path, count
1218823
def finder_for_path(path):
    
    result = None
    # calls any path hooks, gets importer into cache
    pkgutil.get_importer(path)
    loader = sys.path_importer_cache.get(path)
    finder = _finder_registry.get(type(loader))
    if finder:
        module = _dummy_module
        module.__file__ = os.path.join(path, '')
        module.__loader__ = loader
        result = finder(module)
    return result
785400
def isdir(path):
    
    system = get_instance(path)

    # User may use directory path without trailing '/'
    # like on standard file systems
    return system.isdir(system.ensure_dir_path(path))
679991
def _search_path(self, directory_name, filename):
        """"""
        full_path = path.join(directory_name, filename)
        if path.exists(full_path):
            return full_path

        # Could not find the requested file in any of the directories
        return None
948630
def _make_path(self, path, name):
        
        if not os.path.exists(path):
            os.mkdirs(path)

        if os.path.isdir(path) :
            return os.path.join(path, name)

        return path
535472
def GetMountPoint(self, path=None):
    
    path = os.path.abspath(
        client_utils.CanonicalPathToLocalPath(path or self.path))

    while not os.path.ismount(path):
      path = os.path.dirname(path)

    return path
19134
def where(cmd, path=None):
    
    raw_result = shutil.which(cmd, os.X_OK, path)
    if raw_result:
        return os.path.abspath(raw_result)
    else:
        raise ValueError("Could not find '{}' in the path".format(cmd))
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
1367479
def get_base_path(path):
        
        if "%" not in path:
            return path

        path = os.path.split(path)[0]

        while "%" in path:
            path = os.path.split(path)[0]

        return path
1330465
def _relativePath(self, fullPath):
        
        if fullPath is None:
            return None

        assert fullPath.startswith("/"), fullPath

        path = os.path.relpath(fullPath, self.userPath)

        if not path.startswith("../"):
            return path
        elif self.ignoreExtraVolumes:
            return None
        else:
            return fullPath
43151
def get_dir(path_name, *, greedy=False, override=None, identity=None):
    
    if identity is None:
        identity = identify(path_name, override=override)

    path_name = os.path.normpath(path_name)

    if greedy and identity == ISDIR:
        return path_name
    else:
        return os.path.dirname(path_name)
1336281
def cont_path(self, path):
        
        if path.startswith("/"):
            path = path[1:]
        real_path = os.path.join(self.mount_point, path)
        logger.debug("path = %s", real_path)
        return real_path
1319371
def check_path(path, create=False):
    
    if not os.path.exists(path):
        if create:
            os.makedirs(path)
            return os.path.exists(path)
        else:
            return False

    return True