aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-03-26 02:30:10 +0700
committerSergey M․ <dstftw@gmail.com>2017-03-26 02:30:10 +0700
commit51098426b83a8ebce4b0c08e869ce023232089fd (patch)
treea7d851f3b72e81525ea806ee12d72dc660c0d36f /youtube_dl/utils.py
parentfb4fc44928d042a33287fd3e8e18b721c29ff8e8 (diff)
[utils] Introduce expand_path
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index d293c7498..2340bc306 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -39,6 +39,7 @@ from .compat import (
compat_basestring,
compat_chr,
compat_etree_fromstring,
+ compat_expanduser,
compat_html_entities,
compat_html_entities_html5,
compat_http_client,
@@ -539,6 +540,11 @@ def sanitized_Request(url, *args, **kwargs):
return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
+def expand_path(s):
+ """Expand shell variables and ~"""
+ return os.path.expandvars(compat_expanduser(s))
+
+
def orderedSet(iterable):
""" Remove all duplicates from the input iterable """
res = []