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;
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) {