resources/src/main/java/org/robolectric/res/android/CppAssetManager.java
SortedVector<AssetDir.FileInfo> scanDirLocked(final String8 path) {

    String8 pathCopy = new String8(path);
    SortedVector<AssetDir.FileInfo> pContents = null;
    //DIR* dir;
    File dir;
    FileType fileType;

    ALOGV("Scanning dir '%s'\n", path.string());

    dir = new File(path.string());
    if (!dir.exists()) {
      return null;
    }

    pContents = new SortedVector<>();

    for (File entry : dir.listFiles()) {
      if (entry == null) {
        break;
      }

//          if (strcmp(entry.d_name, ".") == 0 ||
//              strcmp(entry.d_name, "..") == 0)
//              continue;

//  #ifdef _DIRENT_HAVE_D_TYPE
//          if (entry.d_type == DT_REG)
//              fileType = kFileTypeRegular;
//          else if (entry.d_type == DT_DIR)
//              fileType = kFileTypeDirectory;
//          else
//              fileType = kFileTypeUnknown;
//  #else
      // stat the file
      fileType = getFileType(pathCopy.appendPath(entry.getName()).string());
//  #endif

      if (fileType != FileType.kFileTypeRegular && fileType != kFileTypeDirectory) {
        continue;
      }

      AssetDir.FileInfo info = new AssetDir.FileInfo();
      info.set(new String8(entry.getName()), fileType);
      if (info.getFileName().getPathExtension().equalsIgnoreCase(".gz")) {
        info.setFileName(info.getFileName().getBasePath());
      }
      info.setSourceName(pathCopy.appendPath(info.getFileName().string()));
      pContents.add(info);
    }

    return pContents;
  }
SortedVector<AssetDir.FileInfo> scanDirLocked(final String8 path) {

    String8 pathCopy = new String8(path);
    SortedVector<AssetDir.FileInfo> pContents = null;
    //DIR* dir;
    File dir;
    FileType fileType;

    ALOGV("Scanning dir '%s'\n", path.string());

    dir = new File(path.string());
    if (!dir.exists()) {
      return null;
    }

    pContents = new SortedVector<>();

    for (File entry : dir.listFiles()) {
      if (entry == null) {
        break;
      }

//          if (strcmp(entry.d_name, ".") == 0 ||
//              strcmp(entry.d_name, "..") == 0)
//              continue;

//  #ifdef _DIRENT_HAVE_D_TYPE
//          if (entry.d_type == DT_REG)
//              fileType = kFileTypeRegular;
//          else if (entry.d_type == DT_DIR)
//              fileType = kFileTypeDirectory;
//          else
//              fileType = kFileTypeUnknown;
//  #else
      // stat the file
      fileType = getFileType(pathCopy.appendPath(entry.getName()).string());
//  #endif

      if (fileType != FileType.kFileTypeRegular && fileType != kFileTypeDirectory) {
        continue;
      }

      AssetDir.FileInfo info = new AssetDir.FileInfo();
      info.set(new String8(entry.getName()), fileType);
      if (info.getFileName().getPathExtension().equalsIgnoreCase(".gz")) {
        info.setFileName(info.getFileName().getBasePath());
      }
      info.setSourceName(pathCopy.appendPath(info.getFileName().string()));
      pContents.add(info);
    }

    return pContents;
  }
/*
Scan the contents of the specified directory, and stuff what we find
into a newly-allocated vector.

Files ending in ".gz" will have their extensions removed.

We should probably think about skipping files with "illegal" names,
e.g. illegal characters (/\:) or excessive length.

Returns null if the specified directory doesn't exist.