mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Keep permissions of the saved files intact. (Backporting 04fe818b2239).
Apparently this code helps for qt5 only. qt4 accepts setPermission, but does not seem to actually implement it.
This commit is contained in:
parent
7bf1392c4d
commit
759769131a
@ -1431,6 +1431,9 @@ bool Buffer::save() const
|
||||
|
||||
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;
|
||||
|
||||
|
@ -278,6 +278,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
|
||||
{
|
||||
|
@ -150,6 +150,8 @@ public:
|
||||
/// 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 & source);
|
||||
|
||||
/// remove pointed directory and all contents.
|
||||
/// \return true on success.
|
||||
|
Loading…
x
Reference in New Issue
Block a user