]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java
1. Fix bug for wrong Variable name in msa file
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / SaveFile.java
index 5d5ab9fd2b700af8c7e025b6d0d358261c59648f..13e6786ca702611394dd8261c1b5ef93d5f697b7 100644 (file)
@@ -36,8 +36,13 @@ public class SaveFile {
      \r
      **/\r
     public static void main(String[] args) {\r
-        // TODO Auto-generated method stub\r
-\r
+        \r
+    }\r
+    \r
+    private static void createDirectory(String path) throws Exception {\r
+        File f = new File(path);\r
+        path = f.getParent();\r
+        FileOperation.newFolder(path);\r
     }\r
 \r
     /**\r
@@ -45,6 +50,11 @@ public class SaveFile {
      \r
      **/\r
     public static void saveMsaFile(String path, ModuleSurfaceArea msa) throws Exception {\r
+        //\r
+        // Create the file's directory first\r
+        //\r
+        createDirectory(path);\r
+        \r
         //\r
         // Remove all empty top level elements\r
         //\r
@@ -218,6 +228,7 @@ public class SaveFile {
         //Save the file\r
         //\r
         msaDoc.save(f, options);\r
+        cursor.dispose();\r
     }\r
 \r
     /**\r
@@ -225,6 +236,11 @@ public class SaveFile {
      \r
      **/\r
     public static void saveSpdFile(String path, PackageSurfaceArea spd) throws Exception {\r
+        //\r
+        // Create the file's directory first\r
+        //\r
+        createDirectory(path);\r
+        \r
         PackageSurfaceAreaDocument spdDoc = PackageSurfaceAreaDocument.Factory.newInstance();\r
         File f = new File(path);\r
 \r
@@ -247,6 +263,7 @@ public class SaveFile {
         //Save the file\r
         //\r
         spdDoc.save(f, options);\r
+        cursor.dispose();\r
     }\r
 \r
     /**\r
@@ -254,6 +271,11 @@ public class SaveFile {
      \r
      **/\r
     public static void saveFpdFile(String path, PlatformSurfaceArea fpd) throws Exception {\r
+        //\r
+        // Create the file's directory first\r
+        //\r
+        createDirectory(path);\r
+        \r
         PlatformSurfaceAreaDocument fpdDoc = PlatformSurfaceAreaDocument.Factory.newInstance();\r
         File f = new File(path);\r
 \r
@@ -276,6 +298,7 @@ public class SaveFile {
         //Save the file\r
         //\r
         fpdDoc.save(f, options);\r
+        cursor.dispose();\r
     }\r
 \r
     /**\r
@@ -306,5 +329,6 @@ public class SaveFile {
         //Save the file\r
         //\r
         dbDoc.save(f, options);\r
+        cursor.dispose();\r
     }\r
 }\r