From ff343c999dffa985dc86044fbb6a447845505fcc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sat, 13 Jan 2024 14:14:54 -0500 Subject: [PATCH] BUG: Fix ctkUtilsCopyDirRecursivelyTest on windows creating hidden files --- .../Cpp/ctkUtilsCopyDirRecursivelyTest1.cpp | 62 ++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/Libs/Core/Testing/Cpp/ctkUtilsCopyDirRecursivelyTest1.cpp b/Libs/Core/Testing/Cpp/ctkUtilsCopyDirRecursivelyTest1.cpp index bdd136c955..e4b36afc0b 100644 --- a/Libs/Core/Testing/Cpp/ctkUtilsCopyDirRecursivelyTest1.cpp +++ b/Libs/Core/Testing/Cpp/ctkUtilsCopyDirRecursivelyTest1.cpp @@ -32,6 +32,11 @@ #include #include +// Windows includes +#ifdef Q_OS_WIN +#include // For SetFileAttributesW +#endif + namespace { //----------------------------------------------------------------------------- @@ -56,6 +61,49 @@ bool createFile(int line, const QDir& dir, const QString& relativePath, const QS return true; } +//----------------------------------------------------------------------------- +bool hideFile(int line, const QDir& dir, const QString& relativePath) +{ + QString filePath = QFileInfo(dir, relativePath).filePath(); + + if (!QFile::exists(filePath)) + { + std::cerr << "Line " << line << " - File" << qPrintable(filePath) << "does not exist" <