]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
1. Restructure some folders and files
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Tools.java
index e63a0f5cf96c006f0eac72d10788681e4fade1cc..3623b2e3c006c1870b800f90a4924b931ea4bbe4 100644 (file)
@@ -141,36 +141,35 @@ public class Tools {
             }\r
         }\r
     }\r
-    \r
+\r
     /**\r
      Get path only from a path\r
-    \r
+     \r
      @param filePath\r
      @return\r
-    \r
-    **/\r
+     \r
+     **/\r
     public static String getFilePathOnly(String filePath) {\r
         String path = filePath.substring(0, filePath.length() - getFileNameOnly(filePath).length());\r
         if (path.endsWith(DataType.FILE_SEPARATOR)) {\r
             path = path.substring(0, path.length() - DataType.FILE_SEPARATOR.length());\r
         }\r
-        \r
+\r
         return path;\r
     }\r
-    \r
-    \r
+\r
     /**\r
      Get file name from a path\r
      \r
      @param filePath\r
      @return\r
-    \r
-    **/\r
+     \r
+     **/\r
     public static String getFileNameOnly(String filePath) {\r
         File f = new File(filePath);\r
         return f.getAbsoluteFile().getName();\r
     }\r
-    \r
+\r
     public static String getFileNameWithoutExt(String filePath) {\r
         filePath = getFileNameOnly(filePath);\r
         filePath = filePath.substring(0, filePath.lastIndexOf(DataType.FILE_EXT_SEPARATOR));\r
@@ -265,14 +264,28 @@ public class Tools {
         }\r
         return path;\r
     }\r
-    \r
+\r
     /**\r
      Show a message box\r
      \r
      @param arg0\r
-    \r
-    **/\r
+     \r
+     **/\r
     public static void showInformationMessage(String arg0) {\r
         JOptionPane.showConfirmDialog(null, arg0, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
     }\r
+    \r
+    /**\r
+    if the string doesn't end with a file separator, append it to the string\r
+    \r
+    @param arg0\r
+    @return\r
+   \r
+   **/\r
+   public static String addFileSeparator(String arg0) {\r
+       if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {\r
+           arg0 = arg0 + DataType.FILE_SEPARATOR;\r
+       }\r
+       return arg0;\r
+   }\r
 }\r