From a77e99f7c226f0ad8bfc057fbcbe838b069e56e3 Mon Sep 17 00:00:00 2001 From: "yaxing.chen" Date: Mon, 25 Jan 2021 11:33:00 +0800 Subject: [PATCH 1/2] fixbug:keep makefile.targets while it has existed --- tools/eclipse.py | 18 ++++++++++++------ tools/rt_studio.py | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/eclipse.py b/tools/eclipse.py index b9d34782a1..0d8d465cbc 100644 --- a/tools/eclipse.py +++ b/tools/eclipse.py @@ -523,10 +523,15 @@ def TargetEclipse(env, reset=False, prj_name=None): # generate projcfg.ini file if not os.path.exists('.settings/projcfg.ini'): - if os.path.exists("template.uvprojx"): - file = os.path.abspath("template.uvprojx") + # if search files with uvprojx or uvproj suffix + items = os.listdir(".") + if len(items) > 0: + for item in items: + if item.endswith(".uvprojx") or item.endswith(".uvproj"): + file = item + break else: - file = os.path.abspath("template.uvproj") + file = "" chip_name = rt_studio.get_mcu_info(file) if rt_studio.gen_projcfg_ini_file(chip_name, prj_name, os.path.abspath(".settings/projcfg.ini")) is False: print('Fail!') @@ -540,9 +545,10 @@ def TargetEclipse(env, reset=False, prj_name=None): return # add clean2 target to fix issues when files too many - if rt_studio.gen_makefile_targets(os.path.abspath("makefile.targets")) is False: - print('Fail!') - return + if not os.path.exists('makefile.targets'): + if rt_studio.gen_makefile_targets(os.path.abspath("makefile.targets")) is False: + print('Fail!') + return project = ProjectInfo(env) diff --git a/tools/rt_studio.py b/tools/rt_studio.py index 0a23d6488b..8b34479509 100644 --- a/tools/rt_studio.py +++ b/tools/rt_studio.py @@ -238,9 +238,9 @@ def get_mcu_info(uvproj_file_path): if result: return result.group(1) else: - return "" + return "unknown" else: - return "" + return "unknown" def gen_makefile_targets(output_file_path): From c38e2bc6ec85310ec4ba63c0d637f9ada474824c Mon Sep 17 00:00:00 2001 From: "yaxing.chen" Date: Mon, 25 Jan 2021 11:42:10 +0800 Subject: [PATCH 2/2] update uvprojx file path to abspath --- tools/eclipse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/eclipse.py b/tools/eclipse.py index 0d8d465cbc..c1cd3c6623 100644 --- a/tools/eclipse.py +++ b/tools/eclipse.py @@ -528,7 +528,7 @@ def TargetEclipse(env, reset=False, prj_name=None): if len(items) > 0: for item in items: if item.endswith(".uvprojx") or item.endswith(".uvproj"): - file = item + file = os.path.abspath(item) break else: file = ""