@@ -476,22 +476,36 @@ private void SendNotification()
476476 {
477477 try
478478 {
479- // Try to find the sound file in the source directory (for development)
480- var soundPath = System . IO . Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Assets" , "alarm.mp3" ) ;
479+ // Try multiple possible locations for the sound file
480+ var possiblePaths = new [ ]
481+ {
482+ // Published version (alarm.mp3 in same directory as executable)
483+ System . IO . Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "alarm.mp3" ) ,
484+ // Development version (in Assets folder)
485+ System . IO . Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Assets" , "alarm.mp3" ) ,
486+ // Source directory (for development)
487+ System . IO . Path . Combine (
488+ System . IO . Directory . GetParent ( AppDomain . CurrentDomain . BaseDirectory ) ? . Parent ? . Parent ? . Parent ? . FullName ?? "" ,
489+ "Assets" , "alarm.mp3" )
490+ } ;
481491
482- if ( ! System . IO . File . Exists ( soundPath ) )
492+ string ? soundPath = null ;
493+ foreach ( var path in possiblePaths )
483494 {
484- // Try looking in the source directory
485- var sourceDir = System . IO . Directory . GetParent ( AppDomain . CurrentDomain . BaseDirectory ) ? . Parent ? . Parent ? . Parent ? . FullName ;
486- if ( sourceDir != null )
495+ if ( System . IO . File . Exists ( path ) )
487496 {
488- soundPath = System . IO . Path . Combine ( sourceDir , "Assets" , "alarm.mp3" ) ;
497+ soundPath = path ;
498+ break ;
489499 }
490500 }
491501
492- if ( ! System . IO . File . Exists ( soundPath ) )
502+ if ( soundPath == null )
493503 {
494- Console . WriteLine ( $ "Sound file not found at: { soundPath } ") ;
504+ Console . WriteLine ( $ "Sound file not found. Tried paths:") ;
505+ foreach ( var path in possiblePaths )
506+ {
507+ Console . WriteLine ( $ " - { path } ") ;
508+ }
495509 return null ;
496510 }
497511
0 commit comments