mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
Some refactoring.
This commit is contained in:
parent
c63d9d7481
commit
55cf5307c6
@ -2784,25 +2784,24 @@ GHC_INLINE path absolute(const path& p, std::error_code& ec)
|
|||||||
return path();
|
return path();
|
||||||
#else
|
#else
|
||||||
path base = current_path(ec);
|
path base = current_path(ec);
|
||||||
path absoluteBase = base.is_absolute() ? base : absolute(base, ec);
|
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
if (p.empty()) {
|
if (p.empty()) {
|
||||||
return absoluteBase / p;
|
return base / p;
|
||||||
}
|
}
|
||||||
if (p.has_root_name()) {
|
if (p.has_root_name()) {
|
||||||
if (p.has_root_directory()) {
|
if (p.has_root_directory()) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return p.root_name() / absoluteBase.root_directory() / absoluteBase.relative_path() / p.relative_path();
|
return p.root_name() / base.root_directory() / base.relative_path() / p.relative_path();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (p.has_root_directory()) {
|
if (p.has_root_directory()) {
|
||||||
return absoluteBase.root_name() / p;
|
return base.root_name() / p;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return absoluteBase / p;
|
return base / p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user