diff options
author | Spencer Williams <spnw@plexwave.org> | 2025-04-14 15:47:26 -0400 |
---|---|---|
committer | Spencer Williams <spnw@plexwave.org> | 2025-04-14 15:47:26 -0400 |
commit | 848aeac4a71779094fd3cc32dbeda4f81051913b (patch) | |
tree | 1383b768355c3620f7590d0fb6ee7c0df5333724 /mpc-bar.m | |
parent | d1e077458de7fca3753940a7fe21f9ace1f6bb56 (diff) |
Support configs named .mpc-bar.ini
Diffstat (limited to 'mpc-bar.m')
-rw-r--r-- | mpc-bar.m | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -103,10 +103,11 @@ static int handler(void *userdata, const char *section, const char *name, config.show_queue = 1; config.show_queue_idle = -1; } +- (BOOL)tryReadConfigFile:(NSString *)file { + return (0 == ini_parse([[NSHomeDirectory() stringByAppendingPathComponent:file] UTF8String], handler, &config)); +} - (void)readConfigFile { - const char *path = [[NSHomeDirectory() - stringByAppendingPathComponent:@".mpcbar"] UTF8String]; - if (ini_parse(path, handler, &config) < 0) { + if (!([self tryReadConfigFile: @".mpc-bar.ini"] || [self tryReadConfigFile: @".mpcbar"])) { NSLog(@"Failed to read config file"); } if (config.show_queue_idle == -1) { |