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
This commit is contained in:
klu2 2006-07-30 08:09:57 +00:00
parent 563671d4d7
commit 2eaa5ba11d

@ -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;
}