Commit 9eeab83b authored by David Jarvie's avatar David Jarvie

Check for invalid filename or non-existent local file

parent 542eae12
......@@ -1626,14 +1626,17 @@ FileType fileType(const QMimeType& mimetype)
FileErr checkFileExists(QString& filename, QUrl& url)
{
// Convert any relative file path to absolute
// (using home directory as the default)
// This also supports absolute paths and absolute urls
url = QUrl::fromUserInput(filename, QDir::homePath());
// (using home directory as the default).
// This also supports absolute paths and absolute urls.
FileErr err = FileErr_None;
url = QUrl::fromUserInput(filename, QDir::homePath());
if (filename.isEmpty())
{
url = QUrl();
err = FileErr_Blank; // blank file name
}
else if (!url.isValid())
err = FileErr_Nonexistent;
else if (!url.isLocalFile())
{
filename = url.toDisplayString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment