diff --git a/src/modules.cc b/src/modules.cc index a4ed5e0..6ca704e 100644 --- a/src/modules.cc +++ b/src/modules.cc @@ -35,11 +35,13 @@ template struct COMPAT().user_data_dir.string())>> { static std::string get_shared_data_dir() { // path::string() returns native encoding on Windows - return rime::Service::instance().deployer().shared_data_dir.string(); + T &deployer = rime::Service::instance().deployer(); + return deployer.shared_data_dir.string(); } static std::string get_user_data_dir() { - return rime::Service::instance().deployer().user_data_dir.string(); + T &deployer = rime::Service::instance().deployer(); + return deployer.user_data_dir.string(); } }; } diff --git a/src/opencc.cc b/src/opencc.cc index 1cf06c9..4413397 100644 --- a/src/opencc.cc +++ b/src/opencc.cc @@ -191,8 +191,9 @@ namespace OpenccReg { template struct COMPAT().user_data_dir.string())>> { static optional make(const string &filename) { - path user_path = Service::instance().deployer().user_data_dir; - path shared_path = Service::instance().deployer().shared_data_dir; + U &deployer = Service::instance().deployer(); + auto user_path = deployer.user_data_dir; + auto shared_path = deployer.shared_data_dir; try{ return T((user_path / "opencc" / filename).u8string()); } diff --git a/src/types.cc b/src/types.cc index 877477d..0f38eb4 100644 --- a/src/types.cc +++ b/src/types.cc @@ -55,19 +55,23 @@ struct COMPAT { template struct COMPAT().user_data_dir.string())>> { static an new_ReverseDb(const std::string &file) { - return New(Service::instance().deployer().user_data_dir / file); + T &deployer = Service::instance().deployer(); + return New(deployer.user_data_dir / file); } static string get_shared_data_dir() { - return Service::instance().deployer().shared_data_dir.string(); + T &deployer = Service::instance().deployer(); + return deployer.shared_data_dir.string(); } static string get_user_data_dir() { - return Service::instance().deployer().user_data_dir.string(); + T &deployer = Service::instance().deployer(); + return deployer.user_data_dir.string(); } static string get_sync_dir() { - return Service::instance().deployer().sync_dir.string(); + T &deployer = Service::instance().deployer(); + return deployer.sync_dir.string(); } }; diff --git a/src/types_ext.cc b/src/types_ext.cc index 99e351d..cd8c6ea 100644 --- a/src/types_ext.cc +++ b/src/types_ext.cc @@ -275,11 +275,6 @@ namespace UserDbReg{ return {}; } - string file_name(const T& t) { - // returns ANSI encoded string on Windows - return t.file_path().string(); - } - bool Open(T &t) { return t.Open(); } bool Close(T &t) { return t.Close(); } bool OpenReadOnly(T &t) { return t.OpenReadOnly(); }