Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
Matching what we have in CentralWidget::openRemoteFile().
  • Loading branch information
agarny committed Oct 23, 2019
1 parent b22d59c commit b9c965d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/plugins/miscellaneous/Core/src/corecliutils.cpp
Expand Up @@ -620,15 +620,21 @@ QString openRemoteFile(const QString &pUrl)

if (readFile(fileNameOrUrl, fileContents, &errorMessage)) {
// We were able to retrieve the contents of the remote file, so ask
// our file manager to create a new remote file and get its filename
// our file manager to create a new remote file

if (!fileManagerInstance->newFile(fileName, fileContents)) {
FileManager::Status status = fileManagerInstance->create(fileNameOrUrl, fileContents);

// Make sure that the file has indeed been created

if (status != FileManager::Status::Created) {
#ifdef QT_DEBUG
qFatal("FATAL ERROR | %s:%d: '%s' could not be created.", __FILE__, __LINE__, qPrintable(fileNameOrUrl));
#else
return QObject::tr("'%1' could not be created.").arg(fileNameOrUrl);
#endif
}

return QString("");
} else {
// We were not able to retrieve the contents of the remote file, so
// let the user know about it
Expand All @@ -638,8 +644,6 @@ QString openRemoteFile(const QString &pUrl)
}
}

// We now have the file so open it, which will add it to the file manager

return openFile(fileName, File::Type::Remote, fileNameOrUrl);
}

Expand Down

0 comments on commit b9c965d

Please sign in to comment.