Esempio n. 1
0
  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;
  }
 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());
     }
   }
 }