mirror of
https://github.com/Dineshkarthik/telegram_media_downloader.git
synced 2024-11-10 08:52:53 +08:00
enh: handle windows file path
This commit is contained in:
parent
c91507d345
commit
ce5201b2ed
1 changed files with 9 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
import os
|
||||
import copy
|
||||
import logging
|
||||
import platform
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
@ -16,7 +17,9 @@ from media_downloader import (
|
|||
process_messages,
|
||||
)
|
||||
|
||||
MOCK_DIR = "/root/project"
|
||||
MOCK_DIR: str = "/root/project"
|
||||
if platform.system() == "Windows":
|
||||
MOCK_DIR = "\\root\\project"
|
||||
MOCK_CONF = {
|
||||
"api_id": 123,
|
||||
"api_hash": "hasw5Tgawsuj67",
|
||||
|
@ -27,8 +30,11 @@ MOCK_CONF = {
|
|||
}
|
||||
|
||||
|
||||
def platform_generic_path(path: str) -> str:
|
||||
return os.path.join("/", *path.split("/"))
|
||||
def platform_generic_path(_path: str) -> str:
|
||||
platform_specific_path: str = _path
|
||||
if platform.system() == "Windows":
|
||||
platform_specific_path = platform_specific_path.replace("/", "\\")
|
||||
return platform_specific_path
|
||||
|
||||
|
||||
class MockMessage:
|
||||
|
|
Loading…
Reference in a new issue