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