Commit Graph

11 Commits

Author SHA1 Message Date
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
sharkykh 66afce7252 Fix silently failing on Windows (#33)
* Fix #31: Silently failing on Windows

* Update Windows test

* Fix test folders not getting removed
2019-04-30 12:28:09 -04:00
Mickaël Schoentgen 020d05979d Windows: Workaround for long paths (#23)
By using the short path version of a file, we can
manage to move long paths to the trash.

Limitations:
1/ If the final short path is longer than what
    `SHFileOperationW` can handle, it will fail
2/ Still not able to trash long path from another
    drive, ie: trying to delete C:\temp\foo.txt
    while the script is running from D:\trash.py
2018-02-16 09:07:05 -05:00
Andrew Senetar 5733670fc2 Workaround embedded null character (#18)
Workaround embedded null characters in strings.  This fixes 17.
2017-11-01 08:28:22 -04:00
Virgil Dupras 016b90c1ac Update copyright 2017-08-03 20:52:19 -04:00
Julian David Rath 6c01453fd3 throwing a WindowsError with the code 2016-04-12 08:53:04 +02: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
Virgil Dupras 899a3efeb3 Converted the compiled win module to ctypes.
--HG--
branch : py3k
2010-10-17 18:00:56 +01:00
Virgil Dupras 2858b5b153 Converted to py3k (haven't tried it on Windows yet, but it should compile and work...)
--HG--
branch : py3k
2010-07-07 16:12:13 +02:00
Virgil Dupras 203973d66c Licensed under BSD. 2010-04-07 08:52:24 +02:00
Virgil Dupras 8a1dff2947 Renamed _trash_* modules to _send2trash_* and added python wrapper around them.
--HG--
rename : modules/trash_osx.c => modules/send2trash_osx.c
rename : modules/trash_win.c => modules/send2trash_win.c
2010-04-06 18:04:32 +02:00