Cfg: Change os.default paths

pull/620/head
gnosygnu 8 years ago
parent 5ae70ac947
commit 1b6eaca401

@ -32,7 +32,7 @@ public class Xoa_app_ {
}
}
public static final String Name = "xowa";
public static final String Version = "4.0.17011.1";
public static final String Version = "3.12.2.1612";
public static String Build_date = "2012-12-30 00:00:00";
public static String Op_sys_str;
public static String User_agent = "";

@ -44,7 +44,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
url_cmd_eval = new Xoa_fsys_eval(fsys_mgr, user.Fsys_mgr());
fsys_mgr.Init_by_app(prog_mgr);
log_wtr.Log_dir_(user.Fsys_mgr().App_temp_dir().GenSubDir("log"));
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, user.Fsys_mgr());
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr);
lang_mgr = new Xoa_lang_mgr(this, gfs_mgr);
wiki_mgr = new Xoae_wiki_mgr(this);
gui_mgr = new Xoa_gui_mgr(this);

@ -29,7 +29,6 @@ public class Xocfg_mgr implements Gfo_invk {
cache_mgr.Init_by_app
( gplx.xowa.addons.apps.cfgs.dbs.Xocfg_db_app.New_conn(app)
, app.User().User_db_mgr().Conn());
dflt_mgr.Init_by_app(app);
}
public void Sub_many_app (Gfo_invk sub, String... keys) {Bind_many(Bool_.N, sub, Xocfg_mgr.Ctx__app, keys);}
public void Bind_many_app (Gfo_invk sub, String... keys) {Bind_many(Bool_.Y, sub, Xocfg_mgr.Ctx__app, keys);}

@ -23,15 +23,6 @@ public class Xocfg_dflt_mgr {
public Xocfg_dflt_mgr(Xocfg_cache_mgr cache_mgr) {
this.cache_mgr = cache_mgr;
}
public void Init_by_app(Xoa_app app) {
Io_url url = app.Fsys_mgr().Bin_plat_dir().GenSubFil_nest("xowa", "cfg", "xo.cfg.dflt.os.gfs");
if (!Io_mgr.Instance.ExistsFil(url)) {
Io_url src_url = url.GenNewNameAndExt("xo.cfg.dflt.os_default.gfs");
if (Io_mgr.Instance.ExistsFil(src_url)) // TEST:
Io_mgr.Instance.CopyFil_args(src_url, url, true).MissingFails_off().Exec();
}
app.Gfs_mgr().Run_url(url);
}
public String Get_or(String key, String or) {
Gfo_invk itm = (Gfo_invk)hash.Get_by(key);
return (itm == null) ? or : (String)Gfo_invk_.Invk_by_key(itm, key);
@ -45,4 +36,13 @@ public class Xocfg_dflt_mgr {
hash.Add_if_dupe_use_nth(key, invk);
}
}
public static void Run_os_gfs(gplx.xowa.apps.gfs.Xoa_gfs_mgr gfs_mgr, gplx.xowa.apps.fsys.Xoa_fsys_mgr fsys_mgr) {
Io_url url = fsys_mgr.Root_dir().GenSubFil_nest("user", "app", "cfg", "os.gfs"); // User_os_gfs(app.Fsys_mgr());
if (!Io_mgr.Instance.ExistsFil(url)) {
Io_url dflt_url = fsys_mgr.Bin_plat_dir().GenSubFil_nest("xowa", "cfg", "os.default.gfs");
if (Io_mgr.Instance.ExistsFil(dflt_url)) // TEST: also, DRD
Io_mgr.Instance.CopyFil_args(dflt_url, url, true).MissingFails_off().Exec();
}
gfs_mgr.Run_url(url);
}
}

@ -36,10 +36,9 @@ public class Xoav_app implements Xoa_app, Gfo_invk {
public Xoav_app(Gfo_usr_dlg usr_dlg, Xoa_app_mode mode, Xog_tab_mgr tab_mgr, String plat_name, Io_url root_dir, Io_url file_dir, Io_url css_dir, Io_url http_root) {
Xoa_app_.Usr_dlg_(usr_dlg); this.usr_dlg = usr_dlg; this.mode = mode;
this.fsys_mgr = new Xoa_fsys_mgr(plat_name, root_dir, root_dir.GenSubDir("wiki"), file_dir, css_dir, http_root);
Xoa_gfs_mgr gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, null);
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr);
this.lang_mgr = new Xoa_lang_mgr(this, gfs_mgr);
this.meta_mgr = new Xoa_meta_mgr(this);
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, null);
this.file__cache_mgr = new Xof_cache_mgr(usr_dlg, null, null);
this.file__img_mgr = new Xof_img_mgr();
this.wiki_mgr = new Xoav_wiki_mgr(this, utl_case_mgr);

@ -19,9 +19,8 @@ package gplx.xowa.apps.gfs; import gplx.*; import gplx.xowa.*; import gplx.xowa.
import gplx.langs.gfs.*;
import gplx.xowa.users.*; import gplx.xowa.apps.fsys.*;
public class Xoa_gfs_mgr implements Gfo_invk, Gfo_invk_root_wkr {
private final Xou_fsys_mgr usr_fsys_mgr;
public Xoa_gfs_mgr(Gfo_invk root_invk, Xoa_fsys_mgr app_fsys_mgr, Xou_fsys_mgr usr_fsys_mgr) {
this.root_invk = root_invk; this.app_fsys_mgr = app_fsys_mgr; this.usr_fsys_mgr = usr_fsys_mgr;
public Xoa_gfs_mgr(Gfo_invk root_invk, Xoa_fsys_mgr app_fsys_mgr) {
this.root_invk = root_invk; this.app_fsys_mgr = app_fsys_mgr;
GfsCore.Instance.AddCmd(root_invk, Xoae_app.Invk_app);
GfsCore.Instance.AddCmd(root_invk, Xoae_app.Invk_xowa);
}
@ -53,18 +52,9 @@ public class Xoa_gfs_mgr implements Gfo_invk, Gfo_invk_root_wkr {
}
}
private void Run_url_by_type(String type) {
Io_url app_data_dir = usr_fsys_mgr.App_data_dir();
Io_url url = null;
if (String_.Eq(type, "user_system_cfg")) url = app_data_dir.GenSubFil_nest("cfg", "user_system_cfg.gfs");
else if (String_.Eq(type, "xowa_cfg_os")) {url = app_fsys_mgr.Bin_plat_dir().GenSubFil_nest("xowa", "cfg", Cfg_os); Xoa_gfs_mgr_.Cfg_os_assert(url);}
else if (String_.Eq(type, "xowa_cfg_app")) url = app_fsys_mgr.Cfg_app_fil();
if (String_.Eq(type, "xowa_cfg_app")) Run_url(app_fsys_mgr.Cfg_app_fil());
else if (String_.Eq(type, "xowa.user.os")) gplx.xowa.addons.apps.cfgs.mgrs.dflts.Xocfg_dflt_mgr.Run_os_gfs(this, app_fsys_mgr);
else throw Err_.new_wo_type("invalid gfs type", "type", type);
try {Run_url(url);}
catch (Exception e) { // gfs is corrupt; may happen if multiple XOWAs opened, and "Close all" chosen in OS; DATE:2014-07-01
if (!String_.Eq(type, "xowa")) // check if user.gfs
Io_mgr.Instance.MoveFil(url, url.GenNewNameOnly(url.NameOnly() + "-" + Datetime_now.Get().XtoStr_fmt_yyyyMMdd_HHmmss())); // move file
Gfo_usr_dlg_.Instance.Warn_many("", "", "invalid gfs; obsoleting: src=~{0} err=~{1}", url.Raw(), Err_.Message_gplx_full(e));
}
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_run_file_by_type)) Run_url_by_type(m.ReadStr("v"));
@ -74,6 +64,5 @@ public class Xoa_gfs_mgr implements Gfo_invk, Gfo_invk_root_wkr {
return this;
} private static final String Invk_run_file_by_type = "run_file_by_type", Invk_fail_if_unhandled_ = "fail_if_unhandled_", Invk_txns = "txns";
public static void Msg_parser_init() {GfsCore.Instance.MsgParser_(gplx.langs.gfs.Gfs_msg_bldr.Instance);}
private static final String Cfg_os = "xowa_cfg_os.gfs";
public static boolean Fail_if_unhandled = false;
}

@ -78,7 +78,7 @@ public class Xog_bnd_win implements Gfo_invk {
return (GfuiTextBox)kit.New_text_box(key, owner_win).Text_(text).Size_(120, 20).Border_on_();
}
private GfuiBtn Make_btn(Gfui_kit kit, GfuiWin owner_win, String key, String text) {
return (GfuiBtn)kit.New_btn(key, owner_win).Text_(text).Size_(40, 20).Focus_able_(true);
return (GfuiBtn)kit.New_btn(key, owner_win).Text_(text).Size_(40, 20).Focus_able_(true).Border_on_();
}
private void Layout(int y, GfuiElem elem_1, GfuiElem elem_2) {
elem_1.Y_(y);

Loading…
Cancel
Save