Remove additional / or \ in relative path.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1134 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-07-28 05:22:00 +00:00
parent a929458e66
commit 53d853a683
3 changed files with 15 additions and 9 deletions

View File

@ -14,13 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.build;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Vector;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@ -32,9 +28,7 @@ import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.FpdModuleIdentification;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
<p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>

View File

@ -68,7 +68,11 @@ public class PackageIdentification extends Identification{
public String getPackageRelativeDir(){
prepareSpdFile();
return spdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);
String relativeDir =spdFile.getParent().substring(GlobalData.getWorkspacePath().length());
if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
relativeDir = relativeDir.substring(1);
}
return relativeDir;
}
private void prepareSpdFile(){

View File

@ -51,10 +51,18 @@ public class PlatformIdentification extends Identification{
}
public String getRelativeFpdFile (){
return fpdFile.getPath().substring(GlobalData.getWorkspacePath().length() + 1);
String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());
if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
relativeDir = relativeDir.substring(1);
}
return relativeDir;
}
public String getPlatformRelativeDir(){
return fpdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);
String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());
if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
relativeDir = relativeDir.substring(1);
}
return relativeDir;
}
}