Skip to content

Commit

Permalink
build with old librime
Browse files Browse the repository at this point in the history
  • Loading branch information
hchunhui committed Oct 27, 2024
1 parent 5819dca commit 335087b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ struct COMPAT {
static string get_sync_dir() {
return string(rime_get_api()->get_sync_dir());
}

static string to_path(const std::string &file) {
return file;
}
};

template<typename T>
Expand All @@ -73,6 +77,10 @@ struct COMPAT<T, void_t<decltype(std::declval<T>().user_data_dir.string())>> {
T &deployer = Service::instance().deployer();
return deployer.sync_dir.string();
}

static path to_path(const std::string &file) {
return path(file);
}
};

//--- wrappers for Segment
Expand Down Expand Up @@ -1217,7 +1225,7 @@ namespace ConfigReg {
int raw_make(lua_State *L) {
an<T> config = New<T>();
if (auto cstr = lua_tostring(L, 1)) {
config->LoadFromFile(path(cstr));
config->LoadFromFile(COMPAT::to_path(cstr));
}
LuaType<an<T>>::pushdata(L, config);
return 1;
Expand Down Expand Up @@ -1282,10 +1290,10 @@ namespace ConfigReg {
}

bool load_from_file(T &t, const string &f) {
return t.LoadFromFile(path(f));
return t.LoadFromFile(COMPAT::to_path(f));
}
bool save_to_file(T &t, const string &f) {
return t.SaveToFile(path(f));
return t.SaveToFile(COMPAT::to_path(f));
}

static const luaL_Reg funcs[] = {
Expand Down

0 comments on commit 335087b

Please sign in to comment.