From d63e5b544596244161c9ee0b66ae4ce7a025ab3d Mon Sep 17 00:00:00 2001 From: "gyeongmin.ju" Date: Fri, 24 Feb 2017 17:40:42 +0900 Subject: [PATCH] RTSDK: fixed template path to /platforms/TizenRT/templates Change-Id: Ib9b3131e55f385126162cd6cd3c46e6623722caa Signed-off-by: gyeongmin.ju --- .../src/org/tizen/rt/ide/util/SDKUtil.java | 34 ++++++++++++++++++++++ .../rt/ide/wizards/NewArtikProjectWizardPage2.java | 7 +++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/SDKUtil.java diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/SDKUtil.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/SDKUtil.java new file mode 100644 index 0000000..a02ebe5 --- /dev/null +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/SDKUtil.java @@ -0,0 +1,34 @@ +package org.tizen.rt.ide.util; + +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SDKUtil { + + private static final Logger logger = LoggerFactory.getLogger(SDKUtil.class); + + public static String getSdkPath() { + String sdkHome = System.getenv("TIZEN_HOME"); + if (sdkHome == null) { + try { + Class platform = Class.forName("org.eclipse.core.runtime.Platform"); + if (platform != null) { + sdkHome = org.eclipse.core.runtime.Platform.getInstallLocation().getURL().getPath(); + sdkHome = URLDecoder.decode(sdkHome, "UTF-8"); + sdkHome = new File(sdkHome).getParent(); + } + } catch (UnsupportedEncodingException e) { + logger.error(e.getMessage(), e); + } catch (ClassNotFoundException e) { + return null; + } + } + + return sdkHome; + } + +} diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java index 7cd602f..6624858 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java @@ -30,6 +30,7 @@ import org.osgi.framework.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tizen.rt.ide.Messages; +import org.tizen.rt.ide.util.SDKUtil; //import swing2swt.layout.BorderLayout; @@ -169,8 +170,10 @@ public class NewArtikProjectWizardPage2 extends WizardPage { } }); - File zipFile = new File(System.getProperty("user.dir") + File.separator + "resources/templates"); - File[] files = zipFile.listFiles(new FilenameFilter() { + String toolPath = SDKUtil.getSdkPath(); + + File tempFile = new File(toolPath, "platforms/TizenRT/templates"); + File[] files = tempFile.listFiles(new FilenameFilter() { @Override public boolean accept(File arg0, String arg1) { return arg0.isDirectory() || (arg0.isFile() && arg1.endsWith(".zip")); -- 2.7.4