From 029988caa912eb2c4be08cb8370c7a3b17a894c8 Mon Sep 17 00:00:00 2001 From: donghee yang Date: Fri, 23 Nov 2012 11:26:02 +0900 Subject: [PATCH] [Title] Changed base directory of user rootstraps to "~/tizen-sdk-data" --- .../nativeplatform/rootstrap/RootstrapManager.java | 41 ++++++++++++++-------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java index e796617..fb2c039 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java @@ -48,6 +48,7 @@ public class RootstrapManager { private static boolean init; private static final String URL_SEP = "|"; private static final String URL_SEP_REGEXP = "[|]"; + private static final String USER_ROOSTRAP_BASE_DIR_NAME = "user-rootstraps"; private RootstrapManager() { } @@ -214,24 +215,31 @@ public class RootstrapManager { .append(pluginFileName).toOSString(); CommandLauncher.execute( String.format("cp %s %s", pluginFilePath, pluginPath)); + // reload + SBIModel.reinitialize(); + result = createRootstrapFromSBIPlugin( pluginId ); + if ( result == null ) { + throw new InterruptedException("Loading SBI plugin failed!"); + } + // extracting file system - String basePath = SmartBuildInterface.getInstance().getBaseRootstrapPath()+"/platform"; - rootstrapPath = basePath + "/" + pluginId; - File baseDirDir = new File(basePath); - if ( !(baseDirDir.exists()) ) { + rootstrapPath = result.getPath().toOSString(); + File baseDirDir = new File(rootstrapPath).getParentFile(); + if ( !baseDirDir.exists() ) { baseDirDir.mkdir(); } + else if ( new File(rootstrapPath).exists() ) { + CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s", rootstrapPath), null ); + } + else { + // nothing to do + } + if ( !CommandLauncher.executeSudo( String.format("sudo -S tar xvf %s/rootstrap.tar.gz", - tempDirPath), basePath, "Platform Internal", monitor ) ) { + tempDirPath), baseDirDir.getPath(), "Platform Internal", monitor ) ) { throw new InterruptedException("Extracting rootsrap failed!"); } - SBIModel.reinitialize(); - result = createRootstrapFromSBIPlugin( pluginId ); - if ( result == null ) { - throw new InterruptedException("Loading SBI plugin failed!"); - } - return result; } catch (Exception e) { @@ -640,15 +648,20 @@ public class RootstrapManager { } + private static String getBaseUserRootstrapPath() { + return new Path(InstallPathConfig.getUserDataPath()) + .append(USER_ROOSTRAP_BASE_DIR_NAME).toOSString(); + } + + private static String getUserRootstrapPath(String id) { - return new Path(SmartBuildInterface.getInstance().getBaseRootstrapPath()) - .append("platform").append(id).toOSString(); + return new Path(getBaseUserRootstrapPath()).append(id).toOSString(); } private static String getUserRootstrapPathOfXml(String id ) { String rootstrapPath = getUserRootstrapPath(id); - return rootstrapPath.replaceAll(InstallPathConfig.getSDKPath(), "#{SBI_HOME}/../.."); + return rootstrapPath.replaceAll(InstallPathConfig.getUserDataPath(), "#{HOME}/tizen-sdk-data"); } } -- 2.7.4