1. Fix EDKT330 Source files in sub-directories are not added to MSA correctly
authorhche10x <hche10x@de2fecce-e211-0410-80a6-f3fac2684e05>
Mon, 16 Oct 2006 06:23:19 +0000 (06:23 +0000)
committerhche10x <hche10x@de2fecce-e211-0410-80a6-f3fac2684e05>
Mon, 16 Oct 2006 06:23:19 +0000 (06:23 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@1752 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
edk2/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java

index 33dc521..b29bfe8 100644 (file)
@@ -230,10 +230,10 @@ public class Tools {
         //\r
         // remove file separator of rear\r
         //\r
-        if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {\r
+        if (path.length() > 0 && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {\r
             path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());\r
         }\r
-        if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {\r
+        if (path.length() > 0 && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {\r
             path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());\r
         }\r
         //\r
index 6ca65fa..d7df17e 100644 (file)
@@ -526,7 +526,12 @@ public class SourceFilesDlg extends IDialog {
             File f[] = fc.getSelectedFiles();\r
             String s = "";\r
             for (int index = 0; index < f.length; index++) {\r
-                s = s + f[index].getName() + ";";\r
+                String relativePath = "";\r
+                relativePath = Tools.getRelativePath(Tools.getFilePathOnly(f[index].getPath()), Tools.getFilePathOnly(msaFileName));\r
+                if (!Tools.isEmpty(relativePath)) {\r
+                    relativePath = relativePath + DataType.UNIX_FILE_SEPARATOR;\r
+                }\r
+                s = s + relativePath + f[index].getName() + ";";\r
             }\r
             this.jTextFieldFileName.setText(s);\r
         }\r