@@ -258,8 +258,11 @@ static bool TrashCustomizedCopy(const fs::path& shared_copy,
258
258
const fs::path& user_copy,
259
259
const string& version_key,
260
260
const fs::path& trash) {
261
- if (fs::equivalent (shared_copy, user_copy))
261
+ if (!fs::exists (shared_copy) ||
262
+ !fs::exists (user_copy) ||
263
+ fs::equivalent (shared_copy, user_copy)) {
262
264
return false ;
265
+ }
263
266
if (IsCustomizedCopy (user_copy.string ())) {
264
267
string shared_copy_version;
265
268
string user_copy_version;
@@ -402,19 +405,16 @@ static bool ConfigNeedsUpdate(Config* config) {
402
405
bool ConfigFileUpdate::Run (Deployer* deployer) {
403
406
fs::path shared_data_path (deployer->shared_data_dir );
404
407
fs::path user_data_path (deployer->user_data_dir );
408
+ // trash depecated user copy created by an older version of Rime
405
409
fs::path source_config_path (shared_data_path / file_name_);
406
410
fs::path dest_config_path (user_data_path / file_name_);
407
411
fs::path trash = user_data_path / " trash" ;
408
- if (!fs::exists (source_config_path)) {
409
- LOG (WARNING) << " '" << file_name_
410
- << " ' is missing from shared data directory." ;
411
- return false ;
412
- }
413
412
if (TrashCustomizedCopy (source_config_path,
414
413
dest_config_path,
415
414
version_key_,
416
415
trash)) {
417
- LOG (INFO) << " patched copy of '" << file_name_ << " ' is moved to trash." ;
416
+ LOG (INFO) << " deprecated user copy of '" << file_name_
417
+ << " ' is moved to " << trash;
418
418
}
419
419
// build the config file if needs update
420
420
the<Config> config (Config::Require (" config" )->Create (file_name_));
0 commit comments