Edit book: When saving a copy dont fail if the original file has no write permissions.

This commit is contained in:
Kovid Goyal 2022-02-09 09:06:38 +05:30
parent 2709a3eb88
commit e13889baed
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -4,7 +4,7 @@
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import shutil, os, errno
import shutil, os, errno, stat
from threading import Thread
from qt.core import (QObject, pyqtSignal, QLabel, QWidget, QHBoxLayout, Qt, QSize)
@ -49,7 +49,7 @@ def save_container(container, path):
# Somebody deleted the original file
if st is not None:
try:
os.fchmod(fno, st.st_mode)
os.fchmod(fno, st.st_mode | stat.S_IWUSR)
except OSError as err:
if err.errno != errno.EPERM:
raise