mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
cm/filesystem: Work around crash when compiled for CYGWIN/MSYS runtime
Issue: #22090
This commit is contained in:
@@ -809,6 +809,10 @@ public:
|
|||||||
|
|
||||||
path& remove_filename()
|
path& remove_filename()
|
||||||
{
|
{
|
||||||
|
# if defined(__CYGWIN__)
|
||||||
|
// FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
|
||||||
|
static_cast<void>(this->path_.data());
|
||||||
|
# endif
|
||||||
auto fname = this->get_filename();
|
auto fname = this->get_filename();
|
||||||
if (!fname.empty()) {
|
if (!fname.empty()) {
|
||||||
this->path_.erase(fname.data() - this->path_.data());
|
this->path_.erase(fname.data() - this->path_.data());
|
||||||
@@ -825,6 +829,10 @@ public:
|
|||||||
|
|
||||||
path& replace_extension(const path& replacement = path())
|
path& replace_extension(const path& replacement = path())
|
||||||
{
|
{
|
||||||
|
# if defined(__CYGWIN__)
|
||||||
|
// FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
|
||||||
|
static_cast<void>(this->path_.data());
|
||||||
|
# endif
|
||||||
auto ext = this->get_filename_fragment(filename_fragment::extension);
|
auto ext = this->get_filename_fragment(filename_fragment::extension);
|
||||||
if (!ext.empty()) {
|
if (!ext.empty()) {
|
||||||
this->path_.erase(ext.data() - this->path_.data());
|
this->path_.erase(ext.data() - this->path_.data());
|
||||||
|
Reference in New Issue
Block a user