fix(util/realpath): rename realpath to lrealpath
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
bc4cef9ecb
commit
53c7124c2b
4 changed files with 8 additions and 4 deletions
|
@ -64,6 +64,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||||
set(CMAKE_CXX_FLAGS_GPROF "-O2 -g -pg")
|
set(CMAKE_CXX_FLAGS_GPROF "-O2 -g -pg")
|
||||||
|
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
check_include_file_cxx("unistd.h" HAVE_UNISTD)
|
||||||
|
|
||||||
# SPLIT_STACK
|
# SPLIT_STACK
|
||||||
if ("${SPLIT_STACK}" MATCHES "ON")
|
if ("${SPLIT_STACK}" MATCHES "ON")
|
||||||
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
|
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
|
||||||
|
|
|
@ -219,7 +219,7 @@ optional<std::string> check_file(std::string const & path, std::string const & f
|
||||||
file += ext;
|
file += ext;
|
||||||
std::ifstream ifile(file);
|
std::ifstream ifile(file);
|
||||||
if (ifile)
|
if (ifile)
|
||||||
return optional<std::string>(realpath(file.c_str()));
|
return optional<std::string>(lrealpath(file.c_str()));
|
||||||
else
|
else
|
||||||
return optional<std::string>();
|
return optional<std::string>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ Author: Leonardo de Moura
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "util/realpath.h"
|
#include "util/realpath.h"
|
||||||
|
|
||||||
#ifdef LEAN_WINDOWS
|
#ifdef LEAN_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace lean {
|
namespace lean {
|
||||||
std::string realpath(char const * fname) {
|
std::string lrealpath(char const * fname) {
|
||||||
#ifdef LEAN_WINDOWS
|
#ifdef LEAN_WINDOWS
|
||||||
constexpr unsigned BufferSize = 8192;
|
constexpr unsigned BufferSize = 8192;
|
||||||
char buffer[BufferSize];
|
char buffer[BufferSize];
|
||||||
|
@ -23,7 +24,7 @@ std::string realpath(char const * fname) {
|
||||||
return std::string(buffer);
|
return std::string(buffer);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char * tmp = ::realpath(fname, nullptr);
|
char * tmp = realpath(fname, nullptr);
|
||||||
std::string r(tmp);
|
std::string r(tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -7,5 +7,5 @@ Author: Leonardo de Moura
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
namespace lean {
|
namespace lean {
|
||||||
std::string realpath(char const * fname);
|
std::string lrealpath(char const * fname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue