2021-08-08 02:48:10 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# Copyright 2017 Virgil Dupras
|
|
|
|
|
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
|
|
|
# which should be included with this package. The terms are also available at
|
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
|
2024-01-11 07:25:22 +00:00
|
|
|
from send2trash.compat import text_type, binary_type, iterable_type
|
|
|
|
|
2021-08-08 02:48:10 +00:00
|
|
|
|
|
|
|
def preprocess_paths(paths):
|
2024-01-11 07:25:22 +00:00
|
|
|
if isinstance(paths, iterable_type) and not isinstance(paths, (text_type, binary_type)):
|
|
|
|
paths = list(paths)
|
|
|
|
elif not isinstance(paths, list):
|
2021-08-08 02:48:10 +00:00
|
|
|
paths = [paths]
|
|
|
|
# Convert items such as pathlib paths to strings
|
2021-08-17 23:58:11 +00:00
|
|
|
paths = [path.__fspath__() if hasattr(path, "__fspath__") else path for path in paths]
|
2021-08-08 02:48:10 +00:00
|
|
|
return paths
|