1. Fix EDKT330 Source files in sub-directories are not added to MSA correctly

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1752 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-10-16 06:23:19 +00:00
parent 5776c5c045
commit 0915a2ce53
2 changed files with 8 additions and 3 deletions

View File

@ -230,10 +230,10 @@ public class Tools {
//
// remove file separator of rear
//
if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
if (path.length() > 0 && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
}
if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
if (path.length() > 0 && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
}
//

View File

@ -526,7 +526,12 @@ public class SourceFilesDlg extends IDialog {
File f[] = fc.getSelectedFiles();
String s = "";
for (int index = 0; index < f.length; index++) {
s = s + f[index].getName() + ";";
String relativePath = "";
relativePath = Tools.getRelativePath(Tools.getFilePathOnly(f[index].getPath()), Tools.getFilePathOnly(msaFileName));
if (!Tools.isEmpty(relativePath)) {
relativePath = relativePath + DataType.UNIX_FILE_SEPARATOR;
}
s = s + relativePath + f[index].getName() + ";";
}
this.jTextFieldFileName.setText(s);
}