Previously the permission were destroyed by the newly created
temporary file -- which is later used as new saved file.
Tested on symlinks as well but only on Linux.
FileName savefile(tempfile->name());
LYXERR(Debug::FILES, "Saving to " << savefile.absFileName());
+ if (!savefile.clonePermissions(fileName()))
+ LYXERR0("Failed to clone the permission from " << fileName().absFileName() << " to " << savefile.absFileName());
+
if (!writeFile(savefile))
return false;
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
{
/// support this.
/// \return true on success.
bool changePermission(unsigned long int mode) const;
+ // sets permission based on the file given as an argument
+ bool clonePermissions(FileName const & target);
/// remove pointed directory and all contents.
/// \return true on success.