I need to find the path of a .wav file in C#
. I can find and run .wav
with the full path "c: \\ pathx ...", however, I need the application to find the file in any directory it is strong>.
I tried to do this:
var file = new FileInfo(Path.Combine(Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location), @"Alarm.wav"));
SoundPlayer soundPlayer = new SoundPlayer(file.ToString());
soundPlayer.Play();
But he can not find Alarm.wav , I ask:
- What's missing?
- Is there another way to do this?