Use standard C++ filesystem API only

This commit is contained in:
Joël Lamotte (Klaim) 2022-05-10 18:00:06 +02:00 committed by Joël Lamotte (Klaim)
parent 73997ab005
commit 9790a87a5d
6 changed files with 9 additions and 10 deletions

View File

@ -12,7 +12,6 @@ dependencies:
- libcurl 7.82.0 *_0
- gtest
- gmock
- cpp-filesystem >=1.5.8
- cpp-expected
- reproc-cpp
- yaml-cpp

View File

@ -1,13 +1,8 @@
#ifndef MAMBA_CORE_FS_HPP
#define MAMBA_CORE_FS_HPP
#ifdef MAMBA_USE_STD_FS
#include <filesystem>
#include <fstream>
namespace fs = std::filesystem;
#else
#include "ghc/filesystem.hpp"
namespace fs = ghc::filesystem;
#endif
#endif

View File

@ -155,7 +155,15 @@ namespace mamba
if (!fs::exists(env_txt_file))
return {};
fs::path abs_loc = fs::absolute(location);
std::error_code fsabs_error;
fs::path abs_loc = fs::absolute(
location, fsabs_error); // If it fails we just get the defaultly constructed path.
if (fsabs_error && !location.empty()) // Ignore cases where we got an empty location.
{
LOG_WARNING << fmt::format("Failed to get absolute path for location '{}' : {}",
location.string(),
fsabs_error.message());
}
std::vector<std::string> lines = read_lines(env_txt_file);
std::set<std::string> final_lines;

View File

@ -12,7 +12,6 @@ dependencies:
- libcurl 7.82.0 *_0
- gtest
- gmock
- cpp-filesystem >=1.5.8
- cpp-expected
- reproc-cpp
- yaml-cpp

View File

@ -12,7 +12,6 @@ dependencies:
- libcurl 7.82.0 *_0
- gtest
- gmock
- cpp-filesystem >=1.5.8
- cpp-expected
- reproc-cpp
- yaml-cpp

View File

@ -12,7 +12,6 @@ dependencies:
- libcurl 7.82.0 *_0
- gtest
- gmock
- cpp-filesystem >=1.5.8
- cpp-expected
- reproc-cpp
- yaml-cpp