From 460d95bf89e55d6e32b2ccabcad6ba051e517717 Mon Sep 17 00:00:00 2001 From: Denys Almazov Date: Thu, 26 Sep 2024 14:40:17 +0300 Subject: [PATCH] fix: fix app size analysis on esp-idf with multiple dots --- .../com/espressif/idf/ui/size/IDFSizeDataManager.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java index 59f798d42..9aa9cd113 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/size/IDFSizeDataManager.java @@ -189,11 +189,12 @@ protected List getCommandArgsArchives(String pythonExecutablenPath, IFil private List addJsonParseCommand() { - List arguments = new ArrayList(); + List arguments = new ArrayList<>(); IEnvironmentVariable idfVersionEnv = new IDFEnvironmentVariables() .getEnv(IDFEnvironmentVariables.ESP_IDF_VERSION); String idfVersion = idfVersionEnv != null ? idfVersionEnv.getValue() : null; - if (idfVersion != null && Double.parseDouble(idfVersion) >= 5.1) + + if (idfVersion != null && parseVersionWithMultipleDotsToDouble(idfVersion) >= 5.1) { arguments.add("--format"); //$NON-NLS-1$ arguments.add("json"); //$NON-NLS-1$ @@ -205,6 +206,12 @@ private List addJsonParseCommand() return arguments; } + public double parseVersionWithMultipleDotsToDouble(String version) + { + String numericVersion = version.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$ + return Double.parseDouble(numericVersion) / Math.pow(10, version.split("\\.").length - 1.0); //$NON-NLS-1$ + } + protected List getCommandArgsSymbolDetails(String pythonExecutablenPath, IFile file) { List arguments = new ArrayList();