Closed jgbishop closed 9 years ago
Hmm. On second look, even that folder doesn't work for me. I must have something misconfigured ... let me look into this again.
OK, so on second look, it appears that Windows expects the file to be named ackrc not .ackrc. This seems like a bug to me (I guess either should be allowed). The documentation that I linked to isn't consistent on which filename to use. Some of the examples show it with the period, others show it without. Either standardizing this, or making it clear what options work where, would be useful I think.
Should I open a separate issue for Windows not working with .ackrc? This issue is specifically about the documentation.
I'm not sure if .ackrc
works on Windows; that's why we also look for _ackrc
. Is that what you meant by ackrc? The documentation should probably reflect the fact that .ackrc
doesn't work on Windows.
@jgbishop Regarding a separate issue for .ackrc
on Windows, I don't know why it doesn't work, but I'm guessing there's a reason _ackrc
was introduced. If you can determine what the reason is, or whether it's still valid, we can see about either enhancing the docs or allowing .ackrc
on Windows.
So I've done a little more research, and I seem to be wrong about things not working. They're just inconsistent. Here's what I see: in Unix-like environments, ack checks the following locations in order:
/etc/ackrc
(no leading period for this filename)$ENV{'ACKRC'}
(if it exists)$HOME/.ackrc
(if $ENV{'ACKRC'}
doesn't exist ... a leading period for this one)cwd()/.ackrc
or cwd()/_ackrc
(leading period or underscore)Windows is similar, though the order is slightly different
Win32::CSIDL_COMMON_APPDATA()/ackrc
(no leading period; resolves to C:\ProgramData
in Win7)Win32::CSIDL_APPDATA()/ackrc
(no leading period; resolves to C:\Users\$User\AppData\Roaming
in Win7)$ENV{'ACKRC'}
(if it exists)cwd()/.ackrc
or cwd()/_ackrc
(leading period or underscore)I guess my confusion stemmed from the fact that there was no consistency with the leading periods, underscores, or lack thereof. The OCD in me says that the file name should probably be the same everywhere, but I'm no expert on the etiquette for dot-file name syntax. Regardless, I've improved the documentation for this section a little bit, and hope to have a pull request for that available shortly.
This sort of inconsistency is common in the Unix word; ex. Vim checks for /etc/vimrc
and ~/.vimrc
, zsh checks /etc/zshrc
and ~/.zshrc
, etc. It's probably a little odd shoe-horning it into the Windows world, but I think one of ack's goals (at least formerly) was to serve as a sort of gateway for Windows folks into Unix tools.
This sort of inconsistency is common in the Unix word
In that case, no logic needs to be changed then. Like I say, I'm no expert. The documentation just tripped me up a little, hence my minor fixes. Thanks!
I'll go ahead and close this issue, since #519 was merged.
The ackrc location semantics section of the ack manual seems incorrect to me. It states that user .ackrc files can be placed in
<C:\Users\$USER\AppData\Roaming>
, but this does not work! I found that if I placed my .ackrc file in my%USERPROFILE%
folder (C:\Users\$USERNAME), ack finds the file as expected.