private void Download_fils(Io_url css_dir, String[] ary) {
   int ary_len = ary.length;
   for (int i = 0; i < ary_len; i++) {
     String src = ary[i];
     Io_url trg =
         css_dir.GenSubFil_nest(
             Op_sys.Cur().Fsys_http_frag_to_url_str(Replace_invalid_chars_str(src)));
     if (Io_mgr.Instance.ExistsFil(trg)) continue;
     download_wkr.Download(true, "https://" + src, trg, "download: " + src); // ILN
     if (Io_mgr.Instance.QueryFil(trg).Size()
         == 0) { // warn if 0 byte files downloaded; DATE:2015-07-06
       Xoa_app_.Usr_dlg()
           .Warn_many("", "", "css.download; 0 byte file downloaded; file=~{0}", trg.Raw());
     }
   }
 }
  public static String Resolve_file(boolean use_file_protocol, Io_url root_dir, String file) {
    String rv = file;

    // resolve relative urls; EX: "./a.js" -> "/xowa/wiki/simple.wikipedia.org/bin/script/a.js"
    if (String_.Has_at_bgn(rv, "./")) {
      // remove "./"
      rv = String_.Mid(rv, 2);

      if (use_file_protocol) rv = root_dir.To_http_file_str() + rv;
      else {
        // if fsys_url && wnt, replace "\" with "/"
        if (Op_sys.Cur().Tid_is_wnt())
          rv = String_.Replace(rv, Op_sys.Lnx.Fsys_dir_spr_str(), Op_sys.Wnt.Fsys_dir_spr_str());
        rv = root_dir.Xto_api() + Op_sys.Cur().Fsys_dir_spr_str() + rv;
      }
    }
    return rv;
  }
 public void Chk(byte[] wiki_domain, Io_url css_fil) {
   this.wiki_domain = wiki_domain;
   List_adp img_list = List_adp_.New();
   byte[] old_bry = Io_mgr.Instance.LoadFilBry(css_fil);
   byte[] rel_url_prefix = Bry_.Add(Bry_fwd_slashes, wiki_domain);
   byte[] new_bry = Convert_to_local_urls(rel_url_prefix, old_bry, img_list);
   Io_url img_dir = css_fil.OwnerDir();
   Download_fils(img_dir, img_list.To_str_ary());
   Io_mgr.Instance.SaveFilBry(css_fil, new_bry);
 }
 public static Fsdb_db_mgr new_src_bin_db_mgr(Xow_wiki wiki, String version) {
   String domain_str = wiki.Domain_str();
   Fsdb_db_mgr rv = null;
   Io_url url = null;
   if (String_.Eq(version, "v1")) {
     url =
         wiki.Fsys_mgr()
             .File_dir()
             .OwnerDir()
             .GenSubDir(domain_str + "-prv"); // v1: EX: /xowa/file/en.wikipedia.org-prv/
     rv = new Fsdb_db_mgr__v1(url);
   } else if (String_.Eq(version, "v2")) {
     url = wiki.Fsys_mgr().Root_dir().GenSubDir("prv"); // v2: EX: /xowa/wiki/en.wikipedia.org/prv/
     rv = Fsdb_db_mgr_.new_detect(wiki, url, url); // note that v2 is prioritized over v1
   } else throw Err_.new_wo_type("fsdb.make:unknown fsdb_type", "version", version);
   if (rv == null)
     throw Err_.new_wo_type(
         "fsdb.make:source fsdb not found", "version", version, "url", url.Raw());
   return rv;
 }