forked from qt-creator/qt-creator
Utils: Add std::expected implementation
Adds a std::expected implementation that is compatible with >= C++11. FilePath::fileContents and FilePath::writeFileContents as well as FilePath::copyFile are changed to return std::expected. A couple of macros have been added to aid in using the expected types. An auto test was added showing how to use the library. Change-Id: Ibe3aecfc1029a0cf13b45bf5184ff03a04a2393b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -680,7 +680,9 @@ static bool copyFileIfNewer(const FilePath &sourceFilePath,
|
||||
|
||||
if (!destinationFilePath.parentDir().ensureWritableDir())
|
||||
return false;
|
||||
return sourceFilePath.copyFile(destinationFilePath);
|
||||
expected_str<void> result = sourceFilePath.copyFile(destinationFilePath);
|
||||
QTC_ASSERT_EXPECTED(result, return false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidBuildApkStep::doRun()
|
||||
|
||||
Reference in New Issue
Block a user