From 3295899230ed6a274055a07929a43418123a43a0 Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 18 Dec 2013 17:51:38 +0100 Subject: [PATCH] Files with relative paths can now be opened from command line Closes #1109 --- CHANGELOG | 1 + src/lib/app/commandlineoptions.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0cdef48ee..3b981294b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ Version 1.5.0 * fixed: parsing OpenSearch files with XML declaration * fixed: don't show urls multiple times in url completer * fixed: drag & drop moving folders under bookmarks toolbar + * fixed: files with relative paths can now be opened from command line Version 1.4.4 * released 1 September 2013 diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index 364f3771f..d721b55c5 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -19,6 +19,7 @@ #include "qupzilla.h" #include +#include CommandLineOptions::CommandLineOptions(int &argc) : m_argc(argc) @@ -176,7 +177,12 @@ void CommandLineOptions::parseActions() } } - const QString &url = arguments.last(); + QString url = arguments.last(); + QFileInfo fileInfo(url); + + if (fileInfo.exists()) { + url = fileInfo.absoluteFilePath(); + } if (m_argc > 1 && !url.isEmpty() && !url.startsWith(QLatin1Char('-')) && (url.contains(QLatin1Char('.')) || url.contains(QLatin1Char('/'))