From d80ff5274a693dbc21735089afd3afc385b0b11e Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 4 Jan 2011 16:02:41 +0000 Subject: [PATCH] [332275] "#" in local file name is changed to "#035" after copy --- .../rse/core/model/SystemEscapeCharHelper.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java index 6228a078686..ea36a1d52c2 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemEscapeCharHelper.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved. + * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -14,12 +14,17 @@ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement * David McKnight (IBM) - [276194] cannot open file with '...' in pathname + * David McKnight (IBM) - [332275] "#" in local file name is changed to "#035" after copy ********************************************************************************/ package org.eclipse.rse.core.model; import java.io.File; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; + /** * This is a utility class used in the construction of file names. * @noextend This class is not intended to be subclassed by clients. @@ -53,6 +58,12 @@ public class SystemEscapeCharHelper { public String getStringForFileName(String name) { + // first do a validation before escaping + IStatus status = ResourcesPlugin.getWorkspace().validatePath(name,IResource.FILE); + if (status.getCode() == IStatus.OK){ // if it's valid, don't bother escaping + return name; + } + String fileName = name; int i = 0;