|
1 | 1 | from .interface import Interface |
2 | 2 | from .utils import in_current_path |
3 | | - |
| 3 | +import os |
4 | 4 |
|
5 | 5 | def prepend(location, app_name=None, shells=None, all_shells=False, home=None, check=False): |
| 6 | + if isinstance(location, os.PathLike): |
| 7 | + location = location.__fspath__() |
6 | 8 | interface = Interface(shells=shells, all_shells=all_shells, home=home) |
7 | 9 | return interface.put(location, front=True, app_name=app_name, check=check) |
8 | 10 |
|
9 | 11 |
|
10 | 12 | def append(location, app_name=None, shells=None, all_shells=False, home=None, check=False): |
| 13 | + if isinstance(location, os.PathLike): |
| 14 | + location = location.__fspath__() |
11 | 15 | interface = Interface(shells=shells, all_shells=all_shells, home=home) |
12 | 16 | return interface.put(location, front=False, app_name=app_name, check=check) |
13 | 17 |
|
14 | 18 |
|
15 | 19 | def in_new_path(location, shells=None, all_shells=False, home=None, check=False): |
| 20 | + if isinstance(location, os.PathLike): |
| 21 | + location = location.__fspath__() |
16 | 22 | interface = Interface(shells=shells, all_shells=all_shells, home=home) |
17 | 23 | return interface.location_in_new_path(location, check=check) |
18 | 24 |
|
19 | 25 |
|
20 | 26 | def need_shell_restart(location, shells=None, all_shells=False, home=None): |
| 27 | + if isinstance(location, os.PathLike): |
| 28 | + location = location.__fspath__() |
21 | 29 | interface = Interface(shells=shells, all_shells=all_shells, home=home) |
22 | 30 | return not in_current_path(location) and interface.location_in_new_path(location) |
0 commit comments