Commit Graph

31 Commits

Author SHA1 Message Date
Andrew Senetar 18e51c0b5a
Minor cleanup in plat_other
- Add OSError code values
- Use INFO_SUFFIX constant in tests
- Remove old PathLike conversions
2021-08-24 01:00:02 -05:00
Andrew Senetar 5e4517aa53
Add fallback to HOMETRASH on plat_other
In the case where os.path.ismount() does not detect a mount and os.rename errors
fallback to HOMETRASH.  This covers several situations where continuing with
the identified trash location is incorrect due to complex mounts.

Close #26, #41, #63.
2021-08-20 22:30:51 -05:00
Andrew Senetar d0e4890a4d
Black format updates with correct line length 2021-08-17 18:58:11 -05:00
Andrew Senetar 94e1ec007a
Add ability to handle pathlib paths
- Handle pathlib paths across all implementations, plat_other already did
- Move preprocessing code to common location
2021-08-07 21:48:10 -05:00
Andrew Senetar 33ed07811b
Cleanup flake8 issues 2021-03-01 23:44:03 -06:00
Andrew Senetar f64c69f905
Merge branch 'master' into master 2021-01-21 18:57:39 -06:00
Mickaël Schoentgen cd8d9fb95e Fix ResourceWarning: unclosed file in
Also prevent potential identical warning in ``.
2020-12-01 08:45:46 +01:00
Magnus Møller Jørgensen 20bbab0b4c
The trash info file needs to exist before the file is moved into the trash folder. 
This is to conform to the events based detection of trashed files in gnome and other file managers.
2020-07-23 03:57:15 +02:00
Andrew Senetar d078554052
Windows Performance Improvement & Multi-Item support (#43)
* Initial IFileOperation for Windows

- Try using IFileOperation instead of SHFileOperation
  - Use pywin32 to accomplish this
  - Implement fallback when pywin32 not available
- Handles paths like `C:\` just fine bu the `\\?\` paths in the test
  cause issue
- Add batching for IFileOperation version (performance)
- Minor formatting applied by editor

* Fix issue with paths starting with \\?\

- Strip these characters off if present just like old implementation

* Add windows version check, legacy list support

- Add check for windows version for IFileOperation
- Add list support to legacy version
- Remove some debugging code
- Fix bug in path converson

Not sure if there is a better way to layout this file

* Split plat_win into legacy and modern

* Update other platforms for list support

Formatter also ran on these so some other minor changes.

* Add unit tests for multi-file calls
2020-06-03 12:49:41 -04:00
Thomas Kluyver 6b0bd46036 Define TrashPermissionError (#21) 2018-02-06 17:28:47 -05:00
Virgil Dupras 016b90c1ac Update copyright 2017-08-03 20:52:19 -04:00
Virgil Dupras f324ff491e Properly reuse the "compat" unit 2017-08-03 20:47:58 -04:00
Thomas Kluyver 7fece243d8 Use bytes throughout plat_other 2017-08-01 12:26:09 +01:00
Kfir Hadas f6f63b1796 Use text_type (unicode for PY2, str for PY3) (#12) 2017-07-07 16:09:16 -04:00
Elan Ruusamäe 72bc94b48d Update
minor typo fix
2016-04-10 11:09:46 +03:00
Virgil Dupras bb8ed834da Add same-codebase support for python 2.7.
When I opted for two codebases for python2/python3,
Send2Trash used C modules and it was easier to just have two
packages. With the ctypes version, supporting both python
versions becomes trivial and it's much more convenient to
merge them back into a single codebase.

I've only tested this code on Linux. I've converted plat_osx and
plat_win, but they only work theoretically.
2013-07-19 18:42:32 -04:00
gbn aee2b7a8af Check access and devices before attempting trash. 2011-03-13 14:40:52 -04:00
gbn d090156c45 Use realpath to find mountpoint 2011-03-13 14:38:03 -04:00
Virgil Dupras 358b705cbc Made a few minor style fixes, and added a proper error in cases where the target path of send2trash() doesn't exist. 2011-03-12 11:48:19 +01:00
gbn eedbe258cb URL Escape the Path in trashinfo 2011-03-10 14:56:19 -05:00
gbn 18e3187c2f Replace == None with is None 2011-03-10 12:22:21 -05:00
gbn 8001be8f37 Remove import * 2011-03-10 12:21:05 -05:00
gbn 13b3943c82 Replace plat_other with one supporting the XDG Trash spec
Added tests for plat_other
2011-03-10 04:55:46 -05:00
Virgil Dupras 02dc392c45 Fixed a bug in plat_other where conflict handling wouldn't be done correctly in external volume. Thanks to John Benediktsson for the tip.
branch : py3k
extra : transplant_source : %C6%11%009sx%B29%CF%EC%CC%D4%88r%BE%D8%BB%9AIa
2010-07-09 21:49:46 -07:00
Virgil Dupras 7546aa606a Fixed an infinite loop in plat_other when using a relative path in a mounted directory.
branch : py3k
extra : transplant_source : %B4%A2%DB%EFn%BB%3A%F6%AE%06%F3%29%DB%06%FBE%D0%A2%BEt
2010-07-09 21:46:19 -07:00
Virgil Dupras 2858b5b153 Converted to py3k (haven't tried it on Windows yet, but it should compile and work...)
branch : py3k
2010-07-07 16:12:13 +02:00
Virgil Dupras f5f9c5b352 Fixed the copyright comment which was at a strange place. 2010-04-21 10:30:51 +02:00
Virgil Dupras 203973d66c Licensed under BSD. 2010-04-07 08:52:24 +02:00
Virgil Dupras ae126c47bf In plat_other, added support for sending to trash on external volumes. 2010-04-06 19:54:10 +02:00
Virgil Dupras cc15b628a2 plat_other tries to see if an Ubuntu-style trash exists and uses it. 2010-04-06 19:11:37 +02:00
Virgil Dupras 6856e49f2d Added the plat_other module (for Linux). 2010-04-06 18:55:30 +02:00