mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-20 12:31:40 +00:00
Fix eraseSuffix()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22355 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a229c5cce7
commit
563a17fb35
@ -504,19 +504,15 @@ Path::appendSuffix(const std::string& suffix) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Path::eraseSuffix() {
|
Path::eraseSuffix() {
|
||||||
std::string save(path);
|
|
||||||
size_t dotpos = path.rfind('.',path.size());
|
size_t dotpos = path.rfind('.',path.size());
|
||||||
size_t slashpos = path.rfind('/',path.size());
|
size_t slashpos = path.rfind('/',path.size());
|
||||||
if (slashpos != std::string::npos &&
|
if (dotpos != std::string::npos) {
|
||||||
dotpos != std::string::npos &&
|
if (slashpos == std::string::npos || dotpos > slashpos) {
|
||||||
dotpos > slashpos) {
|
path.erase(dotpos, path.size()-dotpos);
|
||||||
path.erase(dotpos, path.size()-dotpos);
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isValid()) {
|
return false;
|
||||||
path = save;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user