mirror of https://github.com/mamba-org/mamba.git
Fix locking error (#3572)
This commit is contained in:
parent
b94b30e941
commit
94bb087acb
|
@ -207,7 +207,7 @@ namespace mamba
|
|||
return;
|
||||
}
|
||||
|
||||
// Run `pip freeze`
|
||||
// Run `pip inspect`
|
||||
std::string out, err;
|
||||
|
||||
const auto get_python_path = [&]
|
||||
|
|
|
@ -722,9 +722,18 @@ namespace mamba
|
|||
, m_locked(false)
|
||||
{
|
||||
std::error_code ec;
|
||||
|
||||
// Check if `path` exists
|
||||
if (!fs::exists(path, ec))
|
||||
{
|
||||
throw_lock_error(fmt::format("Could not lock non-existing path '{}'", path.string()));
|
||||
// If `path` doesn't exist, consider creating the directory
|
||||
// (and its parents if they don't exist)
|
||||
if (!fs::create_directories(path, ec))
|
||||
{
|
||||
throw_lock_error(
|
||||
fmt::format("Could not create directory '{}': {}", path.string(), ec.message())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (fs::is_directory(path))
|
||||
|
|
Loading…
Reference in New Issue