[Title] Applied changing sdblib
authordonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 11 Jun 2013 12:51:28 +0000 (21:51 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 11 Jun 2013 12:51:28 +0000 (21:51 +0900)
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java

index be963eb..15b9bcf 100644 (file)
 
 package org.tizen.nativeplatform.launch.wizards;
 
-import static org.tizen.common.util.IOUtil.tryClose;
 import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
 import static org.tizen.sdblib.util.DeviceUtil.isOnline;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
@@ -507,21 +505,11 @@ public class PlatformLaunchUtils {
 
     public void copyFileToDevice(IDevice device, String srcPath, String descPath)
             throws CoreException, TimeoutException, SdbCommandRejectedException, IOException {
-       
-       FileInputStream fileIn = null;
-       try
-       {
-               fileIn = new FileInputStream( srcPath );
-               SyncResult syncSuccess = device.getSyncService().doPush(fileIn, device.getFileEntry( descPath ), null, -1 );
-               
-               if (syncSuccess.getCode() != RESULT_OK) {
-                       LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
-               }
-       }
-       finally
-       {
-               tryClose( fileIn );
-       }
+        String path = new Path(descPath).removeLastSegments(1).toOSString();
+        SyncResult syncResult = device.getSyncService().push(srcPath, device.getFileEntry(path));
+        if (syncResult.getCode() != RESULT_OK) {
+            LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
+        }
     }
 
     public boolean checkGdbServerInBuildSystem(String rootstrapPath) {