Skip to content

Commit dd6ade9

Browse files
committed
Fixed cppcheck-opensource#6231 (mingw compiler error: Path::getAbsoluteFilePath)
1 parent a3efa1e commit dd6ade9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/path.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ bool Path::isHeader(const std::string &path)
223223
std::string Path::getAbsoluteFilePath(const std::string& filePath)
224224
{
225225
std::string absolute_path;
226-
#if defined(__linux__) || defined(__sun) || defined(__hpux) || defined(__GNUC__)
226+
#ifdef _WIN32
227+
char absolute[_MAX_PATH];
228+
if (_fullpath(absolute, filePath.c_str(), _MAX_PATH))
229+
absolute_path = absolute;
230+
#elif defined(__linux__) || defined(__sun) || defined(__hpux) || defined(__GNUC__)
227231
char * absolute = realpath(filePath.c_str(), NULL);
228232
if (absolute)
229233
absolute_path = absolute;
230234
free(absolute);
231-
#elif defined(_WIN32)
232-
char absolute[_MAX_PATH];
233-
if (_fullpath(absolute, filePath.c_str(), _MAX_PATH))
234-
absolute_path = absolute;
235235
#else
236236
#error Platform absolute path function needed
237237
#endif

0 commit comments

Comments
 (0)