mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-08-26 13:53:45 +03:00
Refactored the file path handling in the main script.
- Replaced `os.path` module with `pathlib` for the file path handling to improve code readability and simplicity.
This commit is contained in:
+7
-6
@@ -4,14 +4,15 @@
|
|||||||
# $ python3 -m yt_dlp
|
# $ python3 -m yt_dlp
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
if __package__ is None and not getattr(sys, 'frozen', False):
|
|
||||||
# direct call of __main__.py
|
|
||||||
import os.path
|
|
||||||
path = os.path.realpath(os.path.abspath(__file__))
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(path)))
|
|
||||||
|
|
||||||
import yt_dlp
|
import yt_dlp
|
||||||
|
|
||||||
|
if __package__ is None and not getattr(sys, 'frozen', False):
|
||||||
|
# direct call of __main__.py
|
||||||
|
path = Path(__file__).resolve()
|
||||||
|
sys.path.insert(0, str(path.parent.parent))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
yt_dlp.main()
|
yt_dlp.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user