static Asset openNonAssetInPathLocked(final String fileName, AccessMode mode,
      final asset_path ap) {
    Asset pAsset = null;

      /* look at the filesystem on disk */
    if (ap.type == kFileTypeDirectory) {
      String8 path = new String8(ap.path);
      path.appendPath(fileName);

      pAsset = openAssetFromFileLocked(path, mode);

      if (pAsset == null) {
              /* try again, this time with ".gz" */
        path.append(".gz");
        pAsset = openAssetFromFileLocked(path, mode);
      }

      if (pAsset != null) {
        //printf("FOUND NA '%s' on disk\n", fileName);
        pAsset.setAssetSource(path);
      }

      /* look inside the zip file */
    } else {
      String8 path = new String8(fileName);

          /* check the appropriate Zip file */
      ZipFileRO pZip = getZipFileLocked(ap);
      if (pZip != null) {
        //printf("GOT zip, checking NA '%s'\n", (final char*) path);
        ZipEntryRO entry = pZip.findEntryByName(path.string());
        if (entry != null) {
          //printf("FOUND NA in Zip file for %s\n", appName ? appName : kAppCommon);
          pAsset = openAssetFromZipLocked(pZip, entry, mode, path);
          pZip.releaseEntry(entry);
        }
      }

      if (pAsset != null) {
              /* create a "source" name, for debug/display */
        pAsset.setAssetSource(
            createZipSourceNameLocked(ap.path, new String8(), new String8(fileName)));
      }
    }

    return pAsset;
  }
static Asset openNonAssetInPathLocked(final String fileName, AccessMode mode,
      final asset_path ap) {
    Asset pAsset = null;

      
    if (ap.type == kFileTypeDirectory) {
      String8 path = new String8(ap.path);
      path.appendPath(fileName);

      pAsset = openAssetFromFileLocked(path, mode);

      if (pAsset == null) {
              
        path.append(".gz");
        pAsset = openAssetFromFileLocked(path, mode);
      }

      if (pAsset != null) {
        
        pAsset.setAssetSource(path);
      }

      
    } else {
      String8 path = new String8(fileName);

          
      ZipFileRO pZip = getZipFileLocked(ap);
      if (pZip != null) {
        
        ZipEntryRO entry = pZip.findEntryByName(path.string());
        if (entry != null) {
          
          pAsset = openAssetFromZipLocked(pZip, entry, mode, path);
          pZip.releaseEntry(entry);
        }
      }

      if (pAsset != null) {
              
        pAsset.setAssetSource(
            createZipSourceNameLocked(ap.path, new String8(), new String8(fileName)));
      }
    }

    return pAsset;
  }
static Asset openNonAssetInPathLocked ( final String fileName , AccessMode mode , final asset_path ap ) { Asset pAsset = null ; /* look at the filesystem on disk */ if ( ap . type == kFileTypeDirectory ) { String8 path = new String8 ( ap . path ) ; path . appendPath ( fileName ) ; pAsset = openAssetFromFileLocked ( path , mode ) ; if ( pAsset == null ) { /* try again, this time with ".gz" */ path . append ( ".gz" ) ; pAsset = openAssetFromFileLocked ( path , mode ) ; } if ( pAsset != null ) { //printf("FOUND NA '%s' on disk\n", fileName); pAsset . setAssetSource ( path ) ; } /* look inside the zip file */ } else { String8 path = new String8 ( fileName ) ; /* check the appropriate Zip file */ ZipFileRO pZip = getZipFileLocked ( ap ) ; if ( pZip != null ) { //printf("GOT zip, checking NA '%s'\n", (final char*) path); ZipEntryRO entry = pZip . findEntryByName ( path . string ( ) ) ; if ( entry != null ) { //printf("FOUND NA in Zip file for %s\n", appName ? appName : kAppCommon); pAsset = openAssetFromZipLocked ( pZip , entry , mode , path ) ; pZip . releaseEntry ( entry ) ; } } if ( pAsset != null ) { /* create a "source" name, for debug/display */ pAsset . setAssetSource ( createZipSourceNameLocked ( ap . path , new String8 ( ) , new String8 ( fileName ) ) ) ; } } return pAsset ; }
/*
Open a non-asset file as if it were an asset, searching for it in the
specified app.

Pass in a null values for "appName" if the common app directory should
be used.
/ * Open a non - asset file as if it were an asset searching for it in the specified app .