From 53d853a683b47ad9dc2aed3f55166d8b66c899d2 Mon Sep 17 00:00:00 2001 From: wuyizhong Date: Fri, 28 Jul 2006 05:22:00 +0000 Subject: [PATCH 1/1] Remove additional / or \ in relative path. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1134 6f19259b-4bc3-4df7-8a09-765794883524 --- .../GenBuild/org/tianocore/build/FfsProcess.java | 6 ------ .../tianocore/build/id/PackageIdentification.java | 6 +++++- .../tianocore/build/id/PlatformIdentification.java | 12 ++++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index 9371c7e6d5..2d8ed0b023 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -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; /**

FfsProcess is a class to find the corresponding FFS layout.

diff --git a/Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java b/Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java index 530e4e7907..815fd44528 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java +++ b/Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java @@ -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(){ diff --git a/Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java b/Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java index 39a13d92d6..c5c2f1e030 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java +++ b/Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java @@ -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; } } \ No newline at end of file -- 2.39.2