77 Commits

Author SHA1 Message Date
Kovid Goyal
529033ff78
Dont use win32com for expanduser 2019-06-11 16:04:47 +05:30
Kovid Goyal
795bd06ee9
... 2019-04-11 15:16:29 +05:30
Kovid Goyal
a43207d38a
py3: misc fixes 2019-04-04 08:46:33 +05:30
Eli Schwartz
ea93816515
enforce unicode_literals where possible instead of using u'' everywhere
This file consistently uses unicode strings, so make that more explicit
by migrating to a python3-compatible policy.
2019-04-03 13:39:10 -04:00
Kovid Goyal
3bece11b09
py3: Misc fixes
Fixes #953 (py3: misc fixes trying to start calibre.gui_launch)
2019-04-02 09:31:37 +05:30
Kovid Goyal
5d46f5fbeb
Get rid of iterkeys
dict.__iter__() is the same as iterkeys on both py2 and py3
2019-03-25 14:31:32 +05:30
Eli Schwartz
a623717d96
python3: apply various fixes from python-modernize "dict_six"
Imports were then fixed and consolidated to derive from the internal
polyglot.builtins
2019-03-24 01:18:27 -04:00
Kovid Goyal
d1e30dfcac
Get rid of some xrange 2019-03-13 15:34:10 +05:30
Eli Schwartz
cbc42bec23
python3: add unicode/unichr wrappers to polyglot 2019-03-13 06:41:38 +05:30
Kovid Goyal
2e33cb5cb3
Saving to disk: Fix errors on Linux/macOS if the title/authors are long enough to make individual path components larger than 255 characters. Fixes #1807525 [[Enhancement] Filename length during saving on disk](https://bugs.launchpad.net/calibre/+bug/1807525) 2018-12-29 16:20:14 +05:30
Kovid Goyal
75e59cb3a8
Remove fallback for people running from source without up-to-date binaries 2018-01-28 08:01:40 +05:30
Kovid Goyal
ece8f680c3
Make atomic_rename() work on windows systems with filenames that cannot be encoded using the system codepage 2018-01-18 18:14:58 +05:30
Kovid Goyal
f863d3b46a
Try using node+rapydscript on appveyor as well 2017-06-10 11:22:17 +05:30
Kovid Goyal
8b79484d3a pep8 2017-01-20 08:09:36 +05:30
Eric Hamiter
894e00a796 Fix typo for upto => up to globally 2017-01-14 18:19:27 -06:00
Kovid Goyal
e333001d31 Apply the PEP8 blank line standards to the entire codebase 2016-10-11 11:39:08 +05:30
Kovid Goyal
389d00009b ... 2016-06-25 08:20:47 +05:30
Kovid Goyal
1ebaca2486 Fix file handles to files on the device being inherited by idling worker processes, preventing the device from being ejected 2016-02-07 08:55:15 +05:30
Kovid Goyal
4952caec6c Dont try to use hardlinks on non-NTFS filesystems on windows 2015-12-10 16:02:33 +05:30
Kovid Goyal
66fdc77210 Code to copy files/tress using hard links
First tries with a hard link and if that fails uses a normal file copy
2015-12-10 13:36:15 +05:30
Kovid Goyal
1f99160b3a ... 2015-06-16 14:39:56 +05:30
Charles Haley
4a7f3f5717 Fix problem generating file names in send-to-device and possibly save-to-disk. The original code assumed that the last component always had an extension, which isn't true when evaluating templates to generate a file name. If the resulting string was too long and if last segment of the string contained a period then the remainder of the string after the period was assumed to be an extension. If that remainder was longer than permitted, shorten_components_to generated a path consisting of a single letter.
Example: if the template generated this string:
"Some of the Best From Tor.com, 2013 Edition_ A Tor.Com Original - A. B. C. Personn & Aa Angstrom & Anne McCaffrey & Banks, Iain M & Bruce Sterling & Cajkovskij, Petr Ilic & Chacko, David & Charlie Huston & Collins, Wilkie & D'Ansey, Leigh & Dahl, Roland & Edward Elmer _Doc_ Smith & Eric Flint & George Charon & Jules Verne (1422)"
then the "extension" was everything after the A. B. C., with a length that can easily exceed the max path len.
2014-12-23 11:31:17 +01:00
Kovid Goyal
1b506eefb2 Use win32file.CreateFileW instead of CreateFile since even though the docs for win32file claim that CreateFile supports unicode paths, it actually does not, as it uses the C++ CreateFile underneath via encoding to mbcs 2014-11-22 07:45:42 +05:30
Kovid Goyal
d96714ed24 Edit Book: More descriptive error message when saving fails because of a bad umask 2014-10-06 21:36:47 +05:30
Kovid Goyal
bc8753c7b5 ... 2014-09-02 14:36:34 +05:30
Kovid Goyal
3b8d6e22ce A more complete fix for non ascii usernames on windows when using the export file dialog. See #1298071 ([Edit book]: Crash exporting image) 2014-05-17 07:41:21 +05:30
Kovid Goyal
cebe46bc0e When deleting books from the calibre library, fix empty author folders not being deleted if they contain system generated cache files, like .DS_Store or Thumbs.db. Fixes #1313452 [[Enhancement] Delete author folders upon removal of only book](https://bugs.launchpad.net/calibre/+bug/1313452) 2014-05-01 10:13:37 +05:30
Kovid Goyal
bc85b0948e ... 2013-10-18 11:46:03 +05:30
Kovid Goyal
6946dc5181 Windows atomic folder move: Handle multiple hardlinks to the same file in a folder 2013-10-18 10:55:20 +05:30
Kovid Goyal
68b5b16625 Refactor out the code to get windows file ids 2013-10-18 10:07:48 +05:30
Kovid Goyal
788d2ab6ea Fast hardlink based cloning of book containers 2013-10-06 11:03:25 +05:30
Kovid Goyal
e90ba09426 Use pysqlite for db re-init as apsw cannot discard problem statements
Also move the atomic_rename retry logic into atomic_rename itself,
making it simpler.
2013-08-24 13:08:21 +05:30
Kovid Goyal
3b345d3ff5 On windows add a wait when hardlinking to account for broken network
filesystems
2013-07-22 10:46:29 +05:30
Kovid Goyal
39425a15a3 New API version of library check 2013-07-20 15:46:34 +05:30
Kovid Goyal
7e4a124d52 Ensure we dont leak a file handle 2013-07-04 13:00:08 +05:30
Kovid Goyal
c950518da2 Avoid unnecessary string formatting 2013-07-04 12:18:24 +05:30
Kovid Goyal
ef4efd5768 Refactor creation of hardlinks on windows
After creating the hardlink, open and close the file, to ensure that
the directory entry for the file contains the correct file size, see
http://blogs.msdn.com/b/oldnewthing/archive/2011/12/26/10251026.aspx
2013-07-04 11:11:22 +05:30
Kovid Goyal
16d793049f Fix #1094063 (Problem Disconneting Wirless Connection) 2012-12-28 13:49:23 +05:30
Kovid Goyal
b318b128fe Clearer error message 2012-11-06 12:56:00 +05:30
Kovid Goyal
190c225966 ... 2012-11-02 12:02:58 +05:30
Kovid Goyal
e42140cdc9 Sigh 2012-11-02 10:51:27 +05:30
Kovid Goyal
88620ed588 Compare filesizes to verify the hardlinking worked on windows, more robust 2012-10-29 09:01:28 +05:30
Kovid Goyal
2bfc897266 Windows: Workaround for error while changing title/author with calibre library on a network share. Also explicitly close file handles in samefile() instead of relying on garbage collection. 2012-10-29 01:52:26 +05:30
Kovid Goyal
71b76765eb ... 2012-10-26 09:49:56 +05:30
Kovid Goyal
e561c3f1c5 Only use hardlinks for set_path() not elsewhere. 2012-10-23 08:28:16 +05:30
Kovid Goyal
5d3418f22c When changing the title/author of a book, use hard links instead of copying the file, for a large speedup. 2012-10-22 21:57:44 +05:30
Kovid Goyal
9b21595f92 Make title/author renames completely atomic on windows 2012-10-22 17:31:13 +05:30
Kovid Goyal
1db24f5192 Windows: Check if any of the files of a book are in use before changing the title/author, this (usually) prevents the creation of duplicate files if one of the files is open in another program 2012-10-21 22:14:31 +05:30
Kovid Goyal
944fb4a7fe ... 2012-08-31 18:11:14 +05:30
Kovid Goyal
80300df3f4 samefile_windows(); Return true if the strings are the same upto case differences. 2012-08-30 19:27:53 +05:30