From: klu2 Date: Sun, 30 Jul 2006 08:09:57 +0000 (+0000) Subject: FlashMap can not work correctly in unix GCC because the windows path char "\" exist... X-Git-Tag: edk2-stable201903~24720 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2eaa5ba11d2439b323e113f45c7eb702b873f790 FlashMap can not work correctly in unix GCC because the windows path char "\" exist in parameter. I fix it by adding a NormalizePath function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1152 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/TianoTools/FlashMap/FlashMap.c b/Tools/Source/TianoTools/FlashMap/FlashMap.c index 8e8237507d..191e899ecc 100644 --- a/Tools/Source/TianoTools/FlashMap/FlashMap.c +++ b/Tools/Source/TianoTools/FlashMap/FlashMap.c @@ -87,6 +87,11 @@ Usage ( VOID ); +char* +NormalizePath ( + char* OldPathName + ); + int main ( int argc, @@ -249,8 +254,8 @@ Returns: // Open the file, determine the size, then read it in and write // it back out. // - if ((InFptr = fopen (FileNames->Str, "rb")) == NULL) { - Error (NULL, 0, 0, FileNames->Str, "failed to open input file for reading"); + if ((InFptr = fopen (NormalizePath(FileNames->Str), "rb")) == NULL) { + Error (NULL, 0, 0, NormalizePath(FileNames->Str), "failed to open input file for reading"); goto Done; } fseek (InFptr, 0, SEEK_END); @@ -739,3 +744,24 @@ Returns: fprintf (stdout, "%s\n", Msg[i]); } } + +char* +NormalizePath ( + char* OldPathName + ) +{ + char* Visitor; + + if (OldPathName == NULL) { + return NULL; + } + + Visitor = OldPathName; + while (*Visitor != '\0') { + if (*Visitor == '\\') { + *Visitor = '/'; + } + } + + return Visitor; +} \ No newline at end of file