Fix realpath compile issue on MSVC++, bug1141.

This commit is contained in:
Wilson Snyder 2017-03-15 20:08:19 -04:00
parent 8f8147d646
commit 4aa088eb2f
2 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix internal error on interface arrays, bug1135. [John Stevenson]
**** Fix realpath compile issue on MSVC++, bug1141. [Miodrag Milanovic]
* Verilator 3.900 2017-01-15

View File

@ -147,7 +147,13 @@ string V3Os::filenameRealPath(const string& filename) {
// Get rid of all the ../ behavior in the middle of the paths.
// If there is a ../ that goes down from the 'root' of this path it is preserved.
char retpath[PATH_MAX];
if (realpath(filename.c_str(), retpath)) {
if (
#if defined( _MSC_VER ) || defined( __MINGW32__ )
::_fullpath(retpath,filename.c_str(),PATH_MAX)
#else
realpath(filename.c_str(), retpath)
#endif
) {
return string(retpath);
} else {
return filename;