set up ALSA_CONFIG_PATH. A bit weird...hpdl

This commit is contained in:
Emil Lerch 2025-09-10 16:30:59 -07:00
parent db963784b0
commit 8d52b83a03
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -124,6 +124,18 @@ pub fn main() !void {
defer _ = gpa.deinit();
const allocator = gpa.allocator();
// Check and set ALSA_CONFIG_PATH if not set
if (std.posix.getenv("ALSA_CONFIG_PATH") == null) {
std.fs.cwd().access("alsa.conf", .{}) catch {
_ = std.fs.File.stderr().writeAll("Error: alsa.conf file not found. Please put alsa.conf in the current directory or set ALSA_CONFIG_PATH\n") catch {};
std.process.exit(1);
};
const c = @cImport({
@cInclude("stdlib.h");
});
_ = c.setenv("ALSA_CONFIG_PATH", "alsa.conf", 1);
}
// Set up signal handling for Ctrl+C (SIGINT)
const c = @cImport({
@cInclude("signal.h");