This commit is contained in:
@ -215,7 +215,7 @@ auto is_directory(std::string_view path) -> bool {
|
||||
auto abs_path = utils::path::absolute(path);
|
||||
|
||||
#if defined(_WIN32)
|
||||
return ::PathIsDirectory(abs_path.c_str()) != 0;
|
||||
return ::PathIsDirectoryA(abs_path.c_str()) != 0;
|
||||
#else // !defined(_WIN32)
|
||||
struct stat st {};
|
||||
return (stat(abs_path.c_str(), &st) == 0 && S_ISDIR(st.st_mode));
|
||||
@ -230,8 +230,8 @@ auto is_file(std::string_view path) -> bool {
|
||||
auto abs_path = utils::path::absolute(path);
|
||||
|
||||
#if defined(_WIN32)
|
||||
return (::PathFileExists(abs_path.c_str()) &&
|
||||
not ::PathIsDirectory(abs_path.c_str()));
|
||||
return (::PathFileExistsA(abs_path.c_str()) &&
|
||||
not ::PathIsDirectoryA(abs_path.c_str()));
|
||||
#else // !defined(_WIN32)
|
||||
struct stat st {};
|
||||
return (stat(abs_path.c_str(), &st) == 0 && not S_ISDIR(st.st_mode));
|
@ -69,7 +69,7 @@ namespace repertory::utils::path {
|
||||
auto absolute(std::string_view path) -> std::string {
|
||||
std::string abs_path{path};
|
||||
#if defined(_WIN32)
|
||||
if (not abs_path.empty() && ::PathIsRelative(abs_path.c_str())) {
|
||||
if (not abs_path.empty() && ::PathIsRelativeA(abs_path.c_str())) {
|
||||
std::string temp;
|
||||
temp.resize(MAX_PATH + 1);
|
||||
abs_path = _fullpath(temp.data(), abs_path.c_str(), MAX_PATH);
|
||||
@ -200,7 +200,7 @@ auto remove_file_name(std::string_view path) -> std::string {
|
||||
auto abs_path = absolute(path);
|
||||
|
||||
#if defined(_WIN32)
|
||||
::PathRemoveFileSpec(abs_path.data());
|
||||
::PathRemoveFileSpecA(abs_path.data());
|
||||
abs_path = abs_path.c_str();
|
||||
#else // !defined(_WIN32)
|
||||
if (abs_path != "/") {
|
||||
@ -218,7 +218,7 @@ auto remove_file_name(std::string_view path) -> std::string {
|
||||
|
||||
auto strip_to_file_name(std::string path) -> std::string {
|
||||
#if defined(_WIN32)
|
||||
return ::PathFindFileName(path.c_str());
|
||||
return ::PathFindFileNameA(path.c_str());
|
||||
#else // !defined(_WIN32)
|
||||
return utils::string::contains(path, "/") ? basename(path.data()) : path;
|
||||
#endif // defined(_WIN32)
|
@ -78,8 +78,8 @@ auto run_process_elevated(std::vector<const char *> args) -> int {
|
||||
std::string full_path;
|
||||
full_path.resize(MAX_PATH + 1);
|
||||
|
||||
if (::GetModuleFileName(nullptr, full_path.data(), MAX_PATH)) {
|
||||
SHELLEXECUTEINFO sei{};
|
||||
if (::GetModuleFileNameA(nullptr, full_path.data(), MAX_PATH)) {
|
||||
SHELLEXECUTEINFOA sei{};
|
||||
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
|
||||
sei.cbSize = sizeof(sei);
|
||||
sei.lpVerb = "runas";
|
||||
@ -87,7 +87,7 @@ auto run_process_elevated(std::vector<const char *> args) -> int {
|
||||
sei.lpParameters = parameters.c_str();
|
||||
sei.hwnd = nullptr;
|
||||
sei.nShow = SW_NORMAL;
|
||||
if (::ShellExecuteEx(&sei)) {
|
||||
if (::ShellExecuteExA(&sei)) {
|
||||
::WaitForSingleObject(sei.hProcess, INFINITE);
|
||||
DWORD exit_code{};
|
||||
::GetExitCodeProcess(sei.hProcess, &exit_code);
|
Reference in New Issue
Block a user