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:
@ -87,6 +87,11 @@ Usage (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
char*
|
||||||
|
NormalizePath (
|
||||||
|
char* OldPathName
|
||||||
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
main (
|
main (
|
||||||
int argc,
|
int argc,
|
||||||
@ -249,8 +254,8 @@ Returns:
|
|||||||
// Open the file, determine the size, then read it in and write
|
// Open the file, determine the size, then read it in and write
|
||||||
// it back out.
|
// it back out.
|
||||||
//
|
//
|
||||||
if ((InFptr = fopen (FileNames->Str, "rb")) == NULL) {
|
if ((InFptr = fopen (NormalizePath(FileNames->Str), "rb")) == NULL) {
|
||||||
Error (NULL, 0, 0, FileNames->Str, "failed to open input file for reading");
|
Error (NULL, 0, 0, NormalizePath(FileNames->Str), "failed to open input file for reading");
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
fseek (InFptr, 0, SEEK_END);
|
fseek (InFptr, 0, SEEK_END);
|
||||||
@ -739,3 +744,24 @@ Returns:
|
|||||||
fprintf (stdout, "%s\n", Msg[i]);
|
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;
|
||||||
|
}
|
Reference in New Issue
Block a user