]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
Fix assertion when checking if change in selection
[lyx.git] / src / support / FileName.cpp
index 1e3cacf172bb6408373b03e0a283f8fa3d116028..b485ae939524d989d585110ac5c5aed9d2e2bb76 100644 (file)
 using namespace std;
 using namespace lyx::support;
 
-// OK, this is ugly, but it is the only workaround I found to compile
-// with gcc (any version) on a system which uses a non-GNU toolchain.
-// The problem is that gcc uses a weak symbol for a particular
-// instantiation and that the system linker usually does not
-// understand those weak symbols (seen on HP-UX, tru64, AIX and
-// others). Thus we force an explicit instanciation of this particular
-// template (JMarc)
-template struct boost::detail::crc_table_t<32, 0x04C11DB7, true>;
-
 namespace lyx {
 namespace support {
 
@@ -110,9 +101,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.
@@ -290,6 +288,13 @@ bool FileName::changePermission(unsigned long int mode) const
        return true;
 }
 
+bool FileName::clonePermissions(FileName const & source)
+{
+       QFile fin(toqstr(source.absFileName()));
+       QFile f(toqstr(absFileName()));
+
+       return f.setPermissions(fin.permissions());
+}
 
 string FileName::toFilesystemEncoding() const
 {