From babb1a90c7e813b335fbc4097fd30254411509e6 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 6 Jan 2024 19:02:11 +0100 Subject: [PATCH] Auto-migrate existing .tags_sorted_file to .tags Needed to migrate existing sorted .tags files to new name as it is changed by PR #349. --- ctagsplugin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ctagsplugin.py b/ctagsplugin.py index 58db37e..18c73c3 100644 --- a/ctagsplugin.py +++ b/ctagsplugin.py @@ -772,6 +772,17 @@ def run(self, view, args, tags_file): files = [key] + # Note: Help migrating existing tags files to new file name. + # Needed, because this plugin now sorts .tags file in-place, + # while former versions used to create a dedicated file. + sorted_tags_file = tags_file + '_sorted_by_file' + if os.path.isfile(sorted_tags_file): + try: + os.remove(tags_file) + os.rename(sorted_tags_file, tags_file) + except OSError: + pass + base_path = get_common_ancestor_folder( view.file_name(), view.window().folders())