Skip to content

Commit

Permalink
fix: build with librime 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hchunhui committed Feb 27, 2024
1 parent b2ad34c commit 0f69bfa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ template<typename T>
struct COMPAT<T, void_t<decltype(std::declval<T>().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();
}
};
}
Expand Down
5 changes: 3 additions & 2 deletions src/opencc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ namespace OpenccReg {
template<typename U>
struct COMPAT<U, void_t<decltype(std::declval<U>().user_data_dir.string())>> {
static optional<T> 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());
}
Expand Down
12 changes: 8 additions & 4 deletions src/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,23 @@ struct COMPAT {
template<typename T>
struct COMPAT<T, void_t<decltype(std::declval<T>().user_data_dir.string())>> {
static an<ReverseDb> new_ReverseDb(const std::string &file) {
return New<ReverseDb>(Service::instance().deployer().user_data_dir / file);
T &deployer = Service::instance().deployer();
return New<ReverseDb>(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();
}
};

Expand Down
5 changes: 0 additions & 5 deletions src/types_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down

0 comments on commit 0f69bfa

Please sign in to comment.