]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java
Remove additional / or \ in relative path.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / id / PlatformIdentification.java
1 /** @file
2 This file is to define PlatformIdentification class.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 **/
13
14 package org.tianocore.build.id;
15 import java.io.File;
16
17 import org.tianocore.build.global.GlobalData;
18
19 public class PlatformIdentification extends Identification{
20
21 private File fpdFile;
22
23 public PlatformIdentification(String guid, String version){
24 super(guid, version);
25 }
26
27 public PlatformIdentification(String name, String guid, String version){
28 super(name, guid, version);
29 }
30
31 public PlatformIdentification(String name, String guid, String version, String fpdFilename){
32 super(name, guid, version);
33 this.fpdFile = new File(fpdFilename);
34 }
35
36 public PlatformIdentification(String name, String guid, String version, File fpdFile){
37 super(name, guid, version);
38 this.fpdFile = fpdFile;
39 }
40
41 public String toString(){
42 return "Platform " + name + "["+guid+"]";
43 }
44
45 public void setFpdFile(File fpdFile) {
46 this.fpdFile = fpdFile;
47 }
48
49 public File getFpdFile() {
50 return fpdFile;
51 }
52
53 public String getRelativeFpdFile (){
54 String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());
55 if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
56 relativeDir = relativeDir.substring(1);
57 }
58 return relativeDir;
59 }
60
61 public String getPlatformRelativeDir(){
62 String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());
63 if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
64 relativeDir = relativeDir.substring(1);
65 }
66 return relativeDir;
67 }
68 }