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()
{
Object o = getValue();
System.out.println("selected = "+o);
if (o instanceof IRemoteFile[])
return ((IRemoteFile[])o)[0];
else if (o instanceof IRemoteFile)

View file

@ -418,7 +418,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
{
IHost host = Utilities.parseForSystemConnection(destValue);
IRemoteFile path = Utilities.parseForIRemoteFile(destValue);
action.setHost(host);
action.setDefaultConnection(host);
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.
*/
class RemoteExporter {
private Object as400 = null;
private IHost _host = null;
/**
* 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) {
super();
as400 = s;
_host = s;
}
/**
@ -53,8 +53,8 @@ class RemoteExporter {
*/
public void createFolder(IPath destinationPath) {
// IFS: use IFSJaveFile object if necessary
if (as400 != null)
new UniFilePlus(Utilities.getIRemoteFile((IHost) as400, destinationPath.toString())).mkdir();
if (_host != null)
new UniFilePlus(Utilities.getIRemoteFile((IHost) _host, destinationPath.toString())).mkdir();
else
new File(destinationPath.toOSString()).mkdir();
}
@ -87,8 +87,15 @@ class RemoteExporter {
* file system
*/
protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException, RemoteFileSecurityException, RemoteFileException {
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) as400);
rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, destinationPath.toString(), System.getProperty("file.encoding"), null); //$NON-NLS-1$
IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) _host);
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) {
try {
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);
} catch (SystemMessageException e) {
// get RemoteFileObject has been changed to raise