From: Kornel Benko Date: Sun, 5 Aug 2018 07:54:44 +0000 (+0200) Subject: Expand tilde meaning in front of a path name. X-Git-Tag: lyx-2.4.0dev-acb2ca7b~3212 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ed8dfa3fa0eb75b3f4b73fb55e9018c2ffc39d53;p=features.git 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. --- 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.