async isDeleted()

in packages/web-ide-fs/src/browserfs/OverlayFSDeletedFilesLog.ts [99:122]


  async isDeleted(pathArg: string): Promise<boolean> {
    const path = cleanEndingSeparator(pathArg);
    const log = await this.getContents();

    if (!log) {
      return false;
    }

    if (log.files.has(path) || log.directories.has(path)) {
      return true;
    }

    // TODO: Optimize based on number of deleted directories *and* number of slashes in path
    let currentPath = dirname(path);
    while (currentPath && currentPath !== PATH_ROOT) {
      if (log.directories.has(currentPath)) {
        return true;
      }

      currentPath = dirname(currentPath);
    }

    return false;
  }