set up ALSA_CONFIG_PATH. A bit weird...hpdl
This commit is contained in:
parent
db963784b0
commit
8d52b83a03
1 changed files with 12 additions and 0 deletions
12
src/main.zig
12
src/main.zig
|
@ -124,6 +124,18 @@ pub fn main() !void {
|
||||||
defer _ = gpa.deinit();
|
defer _ = gpa.deinit();
|
||||||
const allocator = gpa.allocator();
|
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)
|
// Set up signal handling for Ctrl+C (SIGINT)
|
||||||
const c = @cImport({
|
const c = @cImport({
|
||||||
@cInclude("signal.h");
|
@cInclude("signal.h");
|
||||||
|
|
Loading…
Add table
Reference in a new issue