Merge "show tips when there is no os file path"

This commit is contained in:
Jenkins
2016-08-09 07:29:11 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 12 deletions

View File

@@ -115,12 +115,15 @@ def get_version_files():
ver_path = get_version_path()
ver_files = []
ver_file_format = ['.iso']
items = os.listdir(ver_path)
for item in items:
full_path = os.path.join(ver_path, item)
if os.path.isfile(full_path) \
and os.path.splitext(full_path)[1] in ver_file_format:
ver_files.append(item)
try:
items = os.listdir(ver_path)
for item in items:
full_path = os.path.join(ver_path, item)
if os.path.isfile(full_path) \
and os.path.splitext(full_path)[1] in ver_file_format:
ver_files.append(item)
except Exception, e:
ver_files = []
return ver_files

View File

@@ -27,12 +27,14 @@ def get_files():
VER_PATH = get_version_path()
files = []
items = os.listdir(VER_PATH)
for item in items:
full_path = os.path.join(VER_PATH, item)
if os.path.isfile(full_path):
files.append(item)
try:
items = os.listdir(VER_PATH)
for item in items:
full_path = os.path.join(VER_PATH, item)
if os.path.isfile(full_path):
files.append(item)
except Exception, e:
files = ['Directory of the Version file does not exist.']
return files