bbatsov / projectile

Project Interaction Library for Emacs
https://docs.projectile.mx
GNU General Public License v3.0
3.99k stars 584 forks source link

Issue with projectile-generic-command #1703

Closed vitek closed 3 years ago

vitek commented 3 years ago

Recently found an issue with generic find command. When issued it returns paths with leading ./, e.g.:

~/configs/emacs$ find .
.
./init.el
./setup.el

While git ls-files and fd does not. Because of leading dot slash projectile does not remove ignored directories and files.

I've also found that fd is called fdfind in ubuntu. Locally I resolved it this way:

  (setq projectile-generic-command
        (if (executable-find "fdfind")
            "fdfind . -0 --type f --color=never"
          "find . -type f -print0 | cut -c3-"))

Think that dot slash should be removed in projectile-files-via-ext-command function.

bbatsov commented 3 years ago

I guess we'll have to update the default generic find command and mention in the docs the situation with fd on Ubuntu.

vitek commented 3 years ago

I'm sorry but "find . -type f -print0 | cut -c3- does not work since there is only one line in -print0 output

goldfita commented 1 year ago

This doesn't work on windows systems. The variable projectile-generic-command is not protected by projectile-unixy-system-p. When I find files in a non-git directory, it complains that it can't find cut. Find happens to be a windows command, though an incompatible version.

goldfita commented 1 year ago

I found a solution. If you have git installed or some other unix utilities in windows with all the required commands, you can just point the path there. Note that you have to modify the path. Setting exec-path doesn't work.

(setenv "PATH" (concat tg/unix-utils-path ";" (getenv "PATH")))