mu: mu-view: don't insist on absolute path

Make it absolute so make_from_path can deal with it.
This commit is contained in:
Dirk-Jan C. Binnema 2023-03-28 20:58:11 +03:00
parent 91bcd0a25b
commit 15777abe3c
1 changed files with 6 additions and 1 deletions

View File

@ -156,7 +156,12 @@ handle_msg(const std::string& fname, const Options& opts)
{
using Format = Options::View::Format;
auto message{Message::make_from_path(fname, message_options(opts.view))};
// make absolute.
const auto fpath{to_string_opt_gchar(g_canonicalize_filename(fname.c_str(), NULL))};
if (!fpath)
return Err(Error::Code::File, "invalid file '%s'", fname.c_str());
auto message{Message::make_from_path(*fpath, message_options(opts.view))};
if (!message)
return Err(message.error());