1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

[180974] fixed remote export

This commit is contained in:
David McKnight 2007-04-20 18:16:38 +00:00
parent fe3b44d754
commit fee9ecb441
4 changed files with 23 additions and 9 deletions

View file

@ -361,7 +361,6 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
public IRemoteFile getSelectedFolder() public IRemoteFile getSelectedFolder()
{ {
Object o = getValue(); Object o = getValue();
System.out.println("selected = "+o);
if (o instanceof IRemoteFile[]) if (o instanceof IRemoteFile[])
return ((IRemoteFile[])o)[0]; return ((IRemoteFile[])o)[0];
else if (o instanceof IRemoteFile) else if (o instanceof IRemoteFile)

View file

@ -418,7 +418,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
{ {
IHost host = Utilities.parseForSystemConnection(destValue); IHost host = Utilities.parseForSystemConnection(destValue);
IRemoteFile path = Utilities.parseForIRemoteFile(destValue); IRemoteFile path = Utilities.parseForIRemoteFile(destValue);
action.setHost(host); action.setDefaultConnection(host);
action.setPreSelection(path); action.setPreSelection(path);
} }

View file

@ -30,14 +30,14 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
* Helper class for exporting resources to the file system. * Helper class for exporting resources to the file system.
*/ */
class RemoteExporter { class RemoteExporter {
private Object as400 = null; private IHost _host = null;
/** /**
* Create an instance of this class. Use this constructor if you wish to * Create an instance of this class. Use this constructor if you wish to
* use an AS400 object */ * use an host object */
public RemoteExporter(IHost s) { public RemoteExporter(IHost s) {
super(); super();
as400 = s; _host = s;
} }
/** /**
@ -53,8 +53,8 @@ class RemoteExporter {
*/ */
public void createFolder(IPath destinationPath) { public void createFolder(IPath destinationPath) {
// IFS: use IFSJaveFile object if necessary // IFS: use IFSJaveFile object if necessary
if (as400 != null) if (_host != null)
new UniFilePlus(Utilities.getIRemoteFile((IHost) as400, destinationPath.toString())).mkdir(); new UniFilePlus(Utilities.getIRemoteFile((IHost) _host, destinationPath.toString())).mkdir();
else else
new File(destinationPath.toOSString()).mkdir(); new File(destinationPath.toOSString()).mkdir();
} }
@ -87,8 +87,15 @@ class RemoteExporter {
* file system * file system
*/ */
protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException, RemoteFileSecurityException, RemoteFileException { protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException, RemoteFileSecurityException, RemoteFileException {
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) as400); IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) _host);
rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, destinationPath.toString(), System.getProperty("file.encoding"), null); //$NON-NLS-1$ String dest = destinationPath.toString();
char sep = rfss.getSeparatorChar();
if (sep != '/')
{
// for windows
dest = dest.replace('/', sep);
}
rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, dest, System.getProperty("file.encoding"), null); //$NON-NLS-1$
} }
/** /**

View file

@ -42,6 +42,14 @@ public class Utilities {
if (c != null) { if (c != null) {
try { try {
IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(c); IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(c);
char sep = ss.getSeparatorChar();
if (sep != '/')
{
// on windows we need win path
path = path.replace('/', sep);
}
ret = ss.getRemoteFileObject(path); ret = ss.getRemoteFileObject(path);
} catch (SystemMessageException e) { } catch (SystemMessageException e) {
// get RemoteFileObject has been changed to raise // get RemoteFileObject has been changed to raise