From a1fc6c4e65eabf22f98c0d7ff75c3272baeba38c Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Thu, 1 May 2014 14:52:18 +0300 Subject: [PATCH] Fix imports & add check_path() --- youtube_dl_gui/Utils.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index 4435766..40790b5 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -5,11 +5,15 @@ import sys import locale import subprocess -import os.remove as remove_file -import os.path.exists as file_exist -import os.path.getsize as get_filesize -import os.makedirs as makedir +from os import ( + remove as remove_file, + makedirs as makedir +) +from os.path import ( + exists as file_exist, + getsize as get_filesize +) def remove_empty_items(array): return [x for x in array if x != ''] @@ -71,7 +75,6 @@ def abs_path(filename): def get_os_type(): return os.name - def get_filename(path): return path.split(get_path_seperator())[-1] @@ -80,3 +83,8 @@ def open_dir(path): os.startfile(path) else: subprocess.call(('xdg-open', path)) + +def check_path(path): + if not file_exist(path): + makedir(path) + \ No newline at end of file