mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: When saving a copy dont fail if the original file has no write permissions.
This commit is contained in:
parent
2709a3eb88
commit
e13889baed
@ -4,7 +4,7 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import shutil, os, errno
|
import shutil, os, errno, stat
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from qt.core import (QObject, pyqtSignal, QLabel, QWidget, QHBoxLayout, Qt, QSize)
|
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
|
# Somebody deleted the original file
|
||||||
if st is not None:
|
if st is not None:
|
||||||
try:
|
try:
|
||||||
os.fchmod(fno, st.st_mode)
|
os.fchmod(fno, st.st_mode | stat.S_IWUSR)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
if err.errno != errno.EPERM:
|
if err.errno != errno.EPERM:
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user