From 6cce130d12789705eeaf86c0e03c21f0d133c5be Mon Sep 17 00:00:00 2001 From: christian Date: Sat, 3 Apr 2021 07:45:03 -0400 Subject: [PATCH] fixed broken audio alerts after media file cleanup --- package.nw/lib/alerts.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package.nw/lib/alerts.js b/package.nw/lib/alerts.js index 68ec5c94..8ac93e39 100644 --- a/package.nw/lib/alerts.js +++ b/package.nw/lib/alerts.js @@ -642,6 +642,16 @@ function playAlertMediaFile(filename, overrideMute) { if (g_appSettings.alertMute && !overrideMute) return; + // check if this is an alert stored with an older version of GT + // which has a full file path given. + if (path.isAbsolute(filename) && !fs.existsSync(filename)){ + // full alert file name stored with old GT version referencing + // the user media dir. determine basename of the file and try + // constructing the path + filename = path.basename(filename); + } + // construct the path from the user media dir or + // fall back on the global media dir var fpath = path.join(g_userMediaDir, filename); if (!fs.existsSync(fpath)) fpath = path.join(g_gtMediaDir, filename);