mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-30 10:58:09 +03:00
Add exception handling for os.path.getmtime
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -113,10 +113,17 @@ class XrayAssetViewerQListWidget(SupportThemeChangedCallback, AppQListWidget):
|
||||
|
||||
for filename in os.listdir(XRAY_ASSET_DIR):
|
||||
if os.path.isfile(XRAY_ASSET_DIR / filename):
|
||||
epoch = os.path.getmtime(XRAY_ASSET_DIR / filename)
|
||||
mdate = datetime.datetime.fromtimestamp(epoch).strftime(
|
||||
'%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
try:
|
||||
# Exception may be raised
|
||||
epoch = os.path.getmtime(XRAY_ASSET_DIR / filename)
|
||||
except Exception:
|
||||
# Any non-exit exceptions
|
||||
|
||||
mdate = ''
|
||||
else:
|
||||
mdate = datetime.datetime.fromtimestamp(epoch).strftime(
|
||||
'%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
|
||||
item = QListWidgetItem(f'{filename:{maxlen + 6}}{mdate}')
|
||||
item.setFont(QFont(APP().customFontName))
|
||||
|
||||
Reference in New Issue
Block a user