Skip to content

Commit 58e51c5

Browse files
authored
fix(SwitcherSettings):load schema list when default.custom.yaml is absent (#1126)
SwitcherSettings::Load returns false if the patch file is absent; it should keep loading the schema list. user code should handle the case when there is no custom setting.
1 parent caa2233 commit 58e51c5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/rime/lever/custom_settings.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ bool CustomSettings::Load() {
3737
}
3838
path custom_config_path =
3939
deployer_->user_data_dir / custom_config_file(config_id_);
40+
modified_ = false;
4041
if (!custom_config_.LoadFromFile(custom_config_path)) {
42+
LOG(WARNING) << "cannot find '" << config_id_ << ".custom.yaml'"
43+
<< " in " << custom_config_path;
4144
return false;
4245
}
43-
modified_ = false;
4446
return true;
4547
}
4648

src/rime/lever/switcher_settings.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ SwitcherSettings::SwitcherSettings(Deployer* deployer)
1919
: CustomSettings(deployer, "default", "Rime::SwitcherSettings") {}
2020

2121
bool SwitcherSettings::Load() {
22-
if (!CustomSettings::Load())
23-
return false;
22+
auto ret = CustomSettings::Load();
2423
available_.clear();
2524
selection_.clear();
2625
hotkeys_.clear();
2726
GetAvailableSchemasFromDirectory(deployer_->shared_data_dir);
2827
GetAvailableSchemasFromDirectory(deployer_->user_data_dir);
2928
GetSelectedSchemasFromConfig();
3029
GetHotkeysFromConfig();
31-
return true;
30+
return ret;
3231
}
3332

3433
bool SwitcherSettings::Select(Selection selection) {

0 commit comments

Comments
 (0)