From 4aa088eb2f838da18d6b749fa9079073fb38e03b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 15 Mar 2017 20:08:19 -0400 Subject: [PATCH] Fix realpath compile issue on MSVC++, bug1141. --- Changes | 2 ++ src/V3Os.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index ebbab7cc7..cd3b90d80 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/src/V3Os.cpp b/src/V3Os.cpp index 44e9238bc..9c014d850 100644 --- a/src/V3Os.cpp +++ b/src/V3Os.cpp @@ -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;