Skip to content
  • Damien R.'s avatar
    search muttrc file according to XDG Base Specification (closes #3207) · b17cd673
    Damien R. authored
    First of all, the MUTT_VERSION symbol is now concatenated (when
    possible) at compile time.
    
    Then, the logic to find the config file has been changed a bit to remove
    unnecessary calls to access(), so now each possible locations for the
    config file is only tested once, and it stops as soon as a valid one has
    been found. So instead of:
    
      access("/home/dkc/.muttrc-1.7.1", F_OK) = -1 ENOENT (No such file or directory)
      access("/home/dkc/.muttrc", F_OK)       = 0
      access("/home/dkc/.muttrc", F_OK)       = 0
      access("/home/dkc/.muttrc", F_OK)       = 0
      [... Tests for Muttrc ... ]
      access("/home/dkc/.muttrc", F_OK)       = 0
    
    We now have:
    
      access("/home/dkc/.muttrc-1.7+13 (f658e517960e)", F_OK) = -1 ENOENT (No such file or directory)
      access("/home/dkc/.muttrc", F_OK)       = 0
    
    It also cleans up the case where -F is passed on the command line but
    points to a non-existent file by moving the error path closer to the
    actual fail condition.
    
    Finally, it adds partial support for the XDG Base Directory
    Specification. mutt will now try to locate its config at:
    
      $XDG_CONFIG_HOME/mutt/muttrc-MUTT_VERSION
      $XDG_CONFIG_HOME/mutt/muttrc.
    
    If XDG_CONFIG_HOME is not set, it will use '~/.config' as a default.
    b17cd673