1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[352248] Indigo upload of executable file on Linux to local system drops executable flags

This commit is contained in:
David McKnight 2011-08-30 17:04:07 +00:00
parent 4ab335dda9
commit 5a7f6e3d53

View file

@ -51,6 +51,7 @@
* Xuan Chen (IBM) - [222544] [testing] FileServiceArchiveTest leaves temporary files and folders behind in TEMP dir
* David McKnight (IBM) - [337612] Failed to copy the content of a tar file
* David McKnight (IBM) - [232084] [local] local file service should not throw operation cancelled exception due to file sizes
* David McKnight (IBM) - [352248] Indigo upload of executable file on Linux to local system drops executable flags
*******************************************************************************/
package org.eclipse.rse.internal.services.local.files;
@ -77,9 +78,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
@ -706,6 +709,21 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
catch (IOException e)
{
}
// preserve executable bit (non-windows only)
String osName = System.getProperty("os.name"); //$NON-NLS-1$
if (!osName.toLowerCase().startsWith("win")) { // not windows //$NON-NLS-1$
// get remote permissions
IHostFile srcFile = getFile(localFile.getParentFile().getAbsolutePath(), localFile.getName(), new NullProgressMonitor());
IHostFile tgtFile = getFile(remoteParent, remoteFile, new NullProgressMonitor());
IHostFilePermissions srcPermissions = getFilePermissions(srcFile, new NullProgressMonitor());
if (srcPermissions != null){
// set these permissions on the temp file
// get local file service
setFilePermissions(tgtFile, srcPermissions, new NullProgressMonitor());
}
}
}
}