mingw: Add implementation of realpath()
The mingw port used _fullpath() until now, but the behaviour is not exactly the same as realpath()'s on unix; major difference being that it doesn't return an error for non-existing files, which would bypass main's error checking and bail out without any error message. Also realpath() will return forward slashes only since main() relies on that.
This commit is contained in:
@@ -394,11 +394,7 @@ int main(int argc, char **argv) {
|
||||
return usage(argv);
|
||||
}
|
||||
} else {
|
||||
#ifdef __MINGW32__
|
||||
char *basedir = _fullpath(NULL, argv[a], _MAX_PATH);
|
||||
#else
|
||||
char *basedir = realpath(argv[a], NULL);
|
||||
#endif
|
||||
if (basedir == NULL) {
|
||||
fprintf(stderr, "%s: can't open file '%s': [Errno %d] ", argv[0], argv[1], errno);
|
||||
perror("");
|
||||
|
||||
Reference in New Issue
Block a user