From ed8dfa3fa0eb75b3f4b73fb55e9018c2ffc39d53 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 5 Aug 2018 09:54:44 +0200 Subject: [PATCH] Expand tilde meaning in front of a path name. This allows to address data in the current lyx-system-directory. The additional prefix is '~:s/' The original prefix '~/' still addresses current users home directory. --- src/support/FileName.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 1e3cacf172..7fa063163a 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -110,9 +110,16 @@ struct FileName::Private static string const handleTildeName(string const & name) { - return name == "~" ? Package::get_home_dir().absFileName() : - prefixIs(name, "~/") ? Package::get_home_dir().absFileName() + name.substr(1) : - name; + string resname; + if ( name == "~" ) + resname = Package::get_home_dir().absFileName(); + else if ( prefixIs(name, "~/")) + resname = Package::get_home_dir().absFileName() + name.substr(1); + else if ( prefixIs(name, "~:s/")) + resname = package().system_support().absFileName() + name.substr(3); + else + resname = name; + return resname; } /// The absolute file name in UTF-8 encoding. -- 2.39.2