mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
appendSuffix: don't append a dot when the suffix is empty.
Additionally, move the implementation of appendSuffix to Path.cpp: it is platform-independent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118089 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -454,7 +454,8 @@ namespace sys {
|
|||||||
/// The precondition for this function is that the Path reference a file
|
/// The precondition for this function is that the Path reference a file
|
||||||
/// name (i.e. isFile() returns true). If the Path is not a file, no
|
/// name (i.e. isFile() returns true). If the Path is not a file, no
|
||||||
/// action is taken and the function returns false. If the path would
|
/// action is taken and the function returns false. If the path would
|
||||||
/// become invalid for the host operating system, false is returned.
|
/// become invalid for the host operating system, false is returned. When
|
||||||
|
/// the \p suffix is empty, no action is performed.
|
||||||
/// @returns false if the suffix could not be added, true if it was.
|
/// @returns false if the suffix could not be added, true if it was.
|
||||||
/// @brief Adds a period and the \p suffix to the end of the pathname.
|
/// @brief Adds a period and the \p suffix to the end of the pathname.
|
||||||
bool appendSuffix(StringRef suffix);
|
bool appendSuffix(StringRef suffix);
|
||||||
|
@@ -195,6 +195,21 @@ StringRef Path::GetDLLSuffix() {
|
|||||||
return &(LTDL_SHLIB_EXT[1]);
|
return &(LTDL_SHLIB_EXT[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Path::appendSuffix(StringRef suffix) {
|
||||||
|
if (!suffix.empty()) {
|
||||||
|
std::string save(path);
|
||||||
|
path.append(".");
|
||||||
|
path.append(suffix);
|
||||||
|
if (!isValid()) {
|
||||||
|
path = save;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isBitcodeFile() const {
|
Path::isBitcodeFile() const {
|
||||||
std::string actualMagic;
|
std::string actualMagic;
|
||||||
|
@@ -637,18 +637,6 @@ Path::eraseComponent() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
Path::appendSuffix(StringRef suffix) {
|
|
||||||
std::string save(path);
|
|
||||||
path.append(".");
|
|
||||||
path.append(suffix);
|
|
||||||
if (!isValid()) {
|
|
||||||
path = save;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::eraseSuffix() {
|
Path::eraseSuffix() {
|
||||||
std::string save = path;
|
std::string save = path;
|
||||||
|
@@ -551,18 +551,6 @@ Path::eraseComponent() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
Path::appendSuffix(StringRef suffix) {
|
|
||||||
std::string save(path);
|
|
||||||
path.append(".");
|
|
||||||
path.append(suffix);
|
|
||||||
if (!isValid()) {
|
|
||||||
path = save;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::eraseSuffix() {
|
Path::eraseSuffix() {
|
||||||
size_t dotpos = path.rfind('.',path.size());
|
size_t dotpos = path.rfind('.',path.size());
|
||||||
|
Reference in New Issue
Block a user