ENH: Added GetFilenameWithoutLastExtension.
This commit is contained in:
parent
1e75dd1212
commit
c5574e096b
@ -1880,6 +1880,27 @@ std::string cmSystemTools::GetFilenameWithoutExtension(const std::string& filena
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file name without extension of a full filename (i.e. without path).
|
||||||
|
* Warning: it considers the last extension (for example: removes .gz
|
||||||
|
* from .tar.gz)
|
||||||
|
*/
|
||||||
|
std::string
|
||||||
|
cmSystemTools::GetFilenameWithoutLastExtension(const std::string& filename)
|
||||||
|
{
|
||||||
|
std::string name = cmSystemTools::GetFilenameName(filename);
|
||||||
|
std::string::size_type dot_pos = name.rfind(".");
|
||||||
|
if(dot_pos != std::string::npos)
|
||||||
|
{
|
||||||
|
return name.substr(0, dot_pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmSystemTools::Glob(const char *directory, const char *regexp,
|
void cmSystemTools::Glob(const char *directory, const char *regexp,
|
||||||
std::vector<std::string>& files)
|
std::vector<std::string>& files)
|
||||||
{
|
{
|
||||||
|
@ -255,6 +255,9 @@ public:
|
|||||||
///! return file name without extension of a full filename.
|
///! return file name without extension of a full filename.
|
||||||
static std::string GetFilenameWithoutExtension(const std::string&);
|
static std::string GetFilenameWithoutExtension(const std::string&);
|
||||||
|
|
||||||
|
///! return file name without its last (shortest) extension.
|
||||||
|
static std::string GetFilenameWithoutLastExtension(const std::string&);
|
||||||
|
|
||||||
static long int ModifiedTime(const char* filename);
|
static long int ModifiedTime(const char* filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user