mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +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
|
||||
Path::eraseSuffix() {
|
||||
std::string save(path);
|
||||
size_t dotpos = path.rfind('.',path.size());
|
||||
size_t slashpos = path.rfind('/',path.size());
|
||||
if (slashpos != std::string::npos &&
|
||||
dotpos != std::string::npos &&
|
||||
dotpos > slashpos) {
|
||||
path.erase(dotpos, path.size()-dotpos);
|
||||
if (dotpos != std::string::npos) {
|
||||
if (slashpos == std::string::npos || dotpos > slashpos) {
|
||||
path.erase(dotpos, path.size()-dotpos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!isValid()) {
|
||||
path = save;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user