Skip to content

Commit b2ef420

Browse files
committed
Yandex: Path Bugs fixes for Windows
1 parent 4ae25e8 commit b2ef420

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fcloud/drivers/yandex/yandex.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ def __init__(self, auth: YandexAuth, main_folder: Path):
6666

6767
@yandex_api_error
6868
def download_file(self, path: Path, local_path: Path) -> None:
69-
self._app.download(str(path), str(local_path))
69+
self._app.download(path.as_posix(), local_path.as_posix())
7070

7171
@yandex_api_error
7272
def upload_file(self, local_path: Path, path: Path) -> str:
7373
filename = os.path.basename(path)
74-
if not self._app.exists(str(path.parent)):
74+
if not self._app.exists(path.parent.as_posix()):
7575
raise PathNotFoundError
7676
files = [file.name for file in self.get_all_files(path.parent)]
7777
if filename in files:
7878
filename = generate_new_name(files, filename)
79-
self._app.upload(str(local_path), str(path.parent.joinpath(filename)))
79+
self._app.upload(
80+
local_path.as_posix(), path.parent.joinpath(filename).as_posix()
81+
)
8082

8183
return filename
8284

@@ -89,16 +91,16 @@ def get_all_files(self, remote_path: Path) -> list[CloudObj]:
8991
is_directory=file.type == "dir",
9092
modifed=file.modified,
9193
)
92-
for file in self._app.listdir(str(remote_path))
94+
for file in self._app.listdir(remote_path.as_posix())
9395
]
9496

9597
@yandex_api_error
9698
def remove_file(self, path: Path) -> None:
97-
self._app.remove(str(path))
99+
self._app.remove(path.as_posix())
98100

99101
@yandex_api_error
100102
def info(self, path: Path) -> dict:
101-
metadata = self._app.get_meta(str(path))
103+
metadata = self._app.get_meta(path.as_posix())
102104
return {
103105
"Path": metadata.path,
104106
"Size": f"{metadata.size} B",

0 commit comments

Comments
 (0)