1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Wiki: Support renamed folders (fix)

This commit is contained in:
gnosygnu
2017-02-06 22:12:56 -05:00
parent 6f9e92afff
commit 938beac9f9
4379 changed files with 0 additions and 327818 deletions

View File

@@ -1,43 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
import gplx.core.brys.fmtrs.*;
import gplx.core.primitives.*; import gplx.xowa.users.*;
public class Xoa_fsys_eval implements Bry_fmtr_eval_mgr {
private final Xoa_fsys_mgr app_fsys_mgr; private final Xou_fsys_mgr usr_fsys_mgr;
public Xoa_fsys_eval(Xoa_fsys_mgr app_fsys_mgr, Xou_fsys_mgr usr_fsys_mgr) {this.app_fsys_mgr = app_fsys_mgr; this.usr_fsys_mgr = usr_fsys_mgr;}
public boolean Enabled() {return enabled;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = true;
public byte[] Eval(byte[] cmd) {
Object o = hash.Get_by_bry(cmd); if (o == null) return null;
byte val = ((Byte_obj_val)o).Val();
switch (val) {
case Tid__xowa_root_dir: return app_fsys_mgr.Root_dir().RawBry();
case Tid__bin_plat_dir: return app_fsys_mgr.Bin_plat_dir().RawBry();
case Tid__user_temp_dir: return usr_fsys_mgr.App_temp_dir().RawBry();
case Tid__user_cfg_dir: return usr_fsys_mgr.App_data_cfg_dir().RawBry();
default: throw Err_.new_unhandled(val);
}
}
private static final byte Tid__bin_plat_dir = 0, Tid__user_temp_dir = 1, Tid__xowa_root_dir = 2, Tid__user_cfg_dir = 3;
private static final Hash_adp_bry hash = Hash_adp_bry.ci_a7()
.Add_str_byte("bin_plat_dir" , Tid__bin_plat_dir)
.Add_str_byte("user_temp_dir" , Tid__user_temp_dir)
.Add_str_byte("xowa_root_dir" , Tid__xowa_root_dir)
.Add_str_byte("user_cfg_dir" , Tid__user_cfg_dir)
;
}

View File

@@ -1,61 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
import gplx.xowa.apps.gfs.*;
import gplx.xowa.wikis.domains.*;
public class Xoa_fsys_mgr implements Gfo_invk {
public Xoa_fsys_mgr(String plat_name, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url css_dir, Io_url http_root) {
this.root_dir = root_dir; this.wiki_dir = wiki_dir; this.file_dir = file_dir; this.css_dir = css_dir; this.http_root = http_root;
this.bin_plat_dir = root_dir.GenSubDir("bin").GenSubDir(plat_name);
this.bin_any_dir = root_dir.GenSubDir("bin").GenSubDir("any");
this.bin_xowa_dir = bin_any_dir.GenSubDir("xowa");
this.bin_xowa_file_dir = bin_xowa_dir.GenSubDir_nest("file");
this.bin_xtns_dir = bin_xowa_dir.GenSubDir_nest("xtns");
this.bin_addon_dir = bin_xowa_dir.GenSubDir_nest("addon");
this.cfg_app_fil = bin_xowa_dir.GenSubFil_nest("cfg", "app", "xowa.gfs");
this.cfg_lang_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "lang", "core");
this.cfg_wiki_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "core");
this.cfg_site_meta_fil = bin_xowa_dir.GenSubFil_nest("cfg", "wiki", "site_meta.sqlite3");
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_itm_.Str__home);
}
public Io_url Root_dir() {return root_dir;} private final Io_url root_dir; // EX: /xowa/
public Io_url Wiki_dir() {return wiki_dir;} private final Io_url wiki_dir; // EX: /xowa/wiki/
public Io_url File_dir() {return file_dir;} private final Io_url file_dir; // EX: /xowa/file/
public Io_url Css_dir() {return css_dir;} private final Io_url css_dir; // EX: /xowa/user/anonymous/wiki/
public Io_url Bin_plat_dir() {return bin_plat_dir;} private final Io_url bin_plat_dir; // EX: /xowa/bin/lnx_64/
public Io_url Bin_any_dir() {return bin_any_dir;} private final Io_url bin_any_dir; // EX: /xowa/bin/any
public Io_url Bin_xowa_dir() {return bin_xowa_dir;} private final Io_url bin_xowa_dir;
public Io_url Bin_xowa_file_dir() {return bin_xowa_file_dir;} private final Io_url bin_xowa_file_dir;
public Io_url Bin_xtns_dir() {return bin_xtns_dir;} private final Io_url bin_xtns_dir;
public Io_url Bin_addon_dir() {return bin_addon_dir;} private final Io_url bin_addon_dir;
public Io_url Cfg_lang_core_dir() {return cfg_lang_core_dir;} private final Io_url cfg_lang_core_dir;
public Io_url Cfg_wiki_core_dir() {return cfg_wiki_core_dir;} private final Io_url cfg_wiki_core_dir;
public Io_url Cfg_site_meta_fil() {return cfg_site_meta_fil;} private final Io_url cfg_site_meta_fil;
public Io_url Wiki_css_dir(String wiki) {return css_dir.GenSubDir_nest(wiki, "html");} // EX: /xowa/temp/simple.wikipedia.org/html/xowa_common.css
public Io_url Wiki_file_dir(String wiki) {return file_dir.GenSubDir_nest(wiki);} // EX: /xowa/temp/simple.wikipedia.org/orig/
public Io_url Home_wiki_dir() {return home_wiki_dir;} private final Io_url home_wiki_dir;
public Io_url Cfg_app_fil() {return cfg_app_fil;} private final Io_url cfg_app_fil;
public Io_url Http_root() {return http_root;} private final Io_url http_root; // EX: file:///xowa/ or file:///android_asset/xowa/
public void Init_by_app(Gfo_invk app_mgr_invk) {this.app_mgr_invk = app_mgr_invk;} private Gfo_invk app_mgr_invk; // for gfs and app.launcher
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_apps)) return app_mgr_invk;
else if (ctx.Match(k, Invk_root_dir)) return root_dir;
else return Gfo_invk_.Rv_unhandled;
}
private static final String Invk_apps = "apps", Invk_root_dir = "root_dir";
}