Skip to content

Commit 5bdadfc

Browse files
committed
commandline touch fixes
1 parent a874f01 commit 5bdadfc

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

Version2.0/Modules/CemrgAppModule/src/CemrgCommandLine.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,23 +1135,23 @@ bool CemrgCommandLine::CheckForStartedProcess() {
11351135
void CemrgCommandLine::ExecuteTouch(QString filepath) {
11361136

11371137
#ifdef _WIN32
1138-
MITK_INFO << "[ATTENTION] touch command only necessary on macOS systems. Step ignored.";
1138+
MITK_INFO << "[ATTENTION] touch command is not necessary on Windows systems. Step ignored.";
11391139
#else
1140+
11401141
QString commandName;
11411142
QStringList arguments;
11421143
commandName = "touch"; // touch filepath
11431144
arguments << filepath;
11441145

11451146
completion = false;
11461147
process->start(commandName, arguments);
1147-
11481148
bool processStarted = CheckForStartedProcess();
11491149
while (!completion) {
11501150
std::this_thread::sleep_for(std::chrono::seconds(1));
11511151
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
11521152
}
1153-
11541153
MITK_INFO(!processStarted) << "[ATTENTION] TOUCH Process never started.";
1154+
11551155
#endif
11561156
}
11571157

@@ -1163,20 +1163,21 @@ bool CemrgCommandLine::IsOutputSuccessful(QString outputFullPath) {
11631163
QFileInfo finfo(outputFullPath);
11641164
bool fileExists = finfo.exists();
11651165
bool fileSizeTest = false;
1166-
bool res = false;
1166+
bool result = false;
11671167

11681168
MITK_INFO << (fileExists ? "File exists." : "Output file not found.");
1169-
if(fileExists){
1169+
1170+
if (fileExists) {
11701171
fileSizeTest = finfo.size() > 0;
1171-
if (fileSizeTest){
1172+
if (fileSizeTest) {
11721173
MITK_INFO << ("File size: " + QString::number(finfo.size())).toStdString();
1173-
res = true;
1174-
} else{
1174+
result = true;
1175+
} else {
11751176
MITK_INFO << "File empty. Output unsuccessful";
11761177
}
1177-
}
1178+
}//_if
11781179

1179-
return res;
1180+
return result;
11801181
}
11811182

11821183
std::string CemrgCommandLine::PrintFullCommand(QString command, QStringList arguments) {
@@ -1217,15 +1218,6 @@ bool CemrgCommandLine::ExecuteCommand(QString executableName, QStringList argume
12171218

12181219
if (processStarted)
12191220
successful = IsOutputSuccessful(outputPath);
1220-
#ifdef _WIN32
1221-
MITK_INFO << "[ATTENTION] command not necessary on Windows systems. Step ignored.";
1222-
#else
1223-
if (successful) {
1224-
QFile(outputPath).copy(outputPath + "copy");
1225-
QFile(outputPath).remove();
1226-
QFile(outputPath + "copy").rename(outputPath);
1227-
}//_if
1228-
#endif
12291221

12301222
return successful;
12311223
}

0 commit comments

Comments
 (0)