mirror of
https://github.com/beetbox/beets.git
synced 2026-01-02 05:52:50 +01:00
warnings about using syspath with some utils
Also pertaining to #58: for most utility functions, paths should *not* be `syspath`-ified. (This only occurs right before a path is sent to the OS.) In fact, as @Wessie discovered, using the result of `syspath` with `ancestry` leads to incorrect behavior. I checked and this should not currently happen anywhere, but these docstring changes make that requirement explicit.
This commit is contained in:
parent
16f207e927
commit
1a94d9e4b7
2 changed files with 8 additions and 0 deletions
|
|
@ -116,8 +116,11 @@ def normpath(path):
|
|||
def ancestry(path, pathmod=None):
|
||||
"""Return a list consisting of path's parent directory, its
|
||||
grandparent, and so on. For instance:
|
||||
|
||||
>>> ancestry('/a/b/c')
|
||||
['/', '/a', '/a/b']
|
||||
|
||||
The argument should *not* be the result of a call to `syspath`.
|
||||
"""
|
||||
pathmod = pathmod or os.path
|
||||
out = []
|
||||
|
|
@ -226,8 +229,11 @@ def prune_dirs(path, root=None, clutter=('.DS_Store', 'Thumbs.db')):
|
|||
|
||||
def components(path, pathmod=None):
|
||||
"""Return a list of the path components in path. For instance:
|
||||
|
||||
>>> components('/a/b/c')
|
||||
['a', 'b', 'c']
|
||||
|
||||
The argument should *not* be the result of a call to `syspath`.
|
||||
"""
|
||||
pathmod = pathmod or os.path
|
||||
comps = []
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ Changelog
|
|||
* Fix for changing date fields (like "year") with the :ref:`modify-cmd`
|
||||
command.
|
||||
* Fix a crash when input is read from a pipe without a specified encoding.
|
||||
* Fix some problem with identifying files on Windows with Unicode directory
|
||||
names in their path.
|
||||
* Add a human-readable error message when writing files' tags fails.
|
||||
* Changed plugin loading so that modules can be imported without
|
||||
unintentionally loading the plugins they contain.
|
||||
|
|
|
|||
Loading…
Reference in a new issue