]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/TianoTools/FlashMap/FlashMap.c
FlashMap can not work correctly in unix GCC because the windows path char "\" exist...
[mirror_edk2.git] / Tools / Source / TianoTools / FlashMap / FlashMap.c
index 8e8237507d7610b42bf6e43ce4d1e7ed38eaf7bb..191e899ecceb1e8d109b6991a6f49f8a92a8aef3 100644 (file)
@@ -87,6 +87,11 @@ Usage (
   VOID\r
   );\r
 \r
+char* \r
+NormalizePath (\r
+  char* OldPathName\r
+  );\r
+\r
 int\r
 main (\r
   int   argc,\r
@@ -249,8 +254,8 @@ Returns:
     // Open the file, determine the size, then read it in and write\r
     // it back out.\r
     //\r
-    if ((InFptr = fopen (FileNames->Str, "rb")) == NULL) {\r
-      Error (NULL, 0, 0, FileNames->Str, "failed to open input file for reading");\r
+    if ((InFptr = fopen (NormalizePath(FileNames->Str), "rb")) == NULL) {\r
+      Error (NULL, 0, 0, NormalizePath(FileNames->Str), "failed to open input file for reading");\r
       goto Done;\r
     }\r
     fseek (InFptr, 0, SEEK_END);\r
@@ -739,3 +744,24 @@ Returns:
     fprintf (stdout, "%s\n", Msg[i]);\r
   }\r
 }\r
+\r
+char* \r
+NormalizePath (\r
+  char* OldPathName\r
+  )\r
+{\r
+  char* Visitor;\r
+  \r
+  if (OldPathName == NULL) {\r
+    return NULL;\r
+  }\r
+  \r
+  Visitor = OldPathName;\r
+  while (*Visitor != '\0') {\r
+    if (*Visitor == '\\') {\r
+      *Visitor = '/';\r
+    }\r
+  }\r
+  \r
+  return Visitor;\r
+}
\ No newline at end of file