cakebrewjs icon indicating copy to clipboard operation
cakebrewjs copied to clipboard

App doesn't work with non-standard installation

Open tomodachi94 opened this issue 2 years ago • 2 comments

This looks like an awesome project! However, it appears that Homebrew installations that aren't in /opt/homebrew aren't recognized by the operating system. Are there plans to change this e.g. by checking for the HOMEBREW_PREFIX environment variable or by looking in all locations on path?

tomodachi94 avatar Nov 30 '22 20:11 tomodachi94

Nevermind, just found the settings menu. Should I close this?

tomodachi94 avatar Nov 30 '22 20:11 tomodachi94

Actually you can help (if you'd like) by answering this...

I have added already

https://github.com/shemeshg/cakebrewjs/blob/947c85a2f0e39bd3b6cc76cad31dc04cc4279a22/src/src/Ls.ts#L14

Can you confirm if it is correct/incorrect/or how should be modified?

get senceBrewLocation(){
    const existsSync = require("electron").remote.require("fs").existsSync
    if  (existsSync("/opt/homebrew/bin/brew")){
      this.brewLocation = "/opt/homebrew/bin/brew"
      return "/opt/homebrew/bin/brew"
    } else if  (existsSync("/usr/local/bin/brew")) {
      this.brewLocation = "/usr/local/bin/brew"
      return "/usr/local/bin/brew"
    } else {
      return "/usr/local/bin/brew"
    }

  }

To test default behavior on your machine you can

  1. Manu->View->toggle devtools

  2. Delete the local storage.

  3. If you can clone the project and test it locally and submit PR it would be more then awesome (it is just git clone and then npm run electron:serve (But don't feel fearful if step [3] it is too much to ask) ..

  4. I assume brew --prefix is always brewLocation.replace("/bin/brew","") for example

% brew --prefix
/usr/local
% which brew
/usr/local/bin/brew
%

so caskroom would be at ${brewPrefix}/Caskroom/ that is for example /usr/local/Caskroom. is this not always the case?

Thanks Shemeshg

shemeshg avatar Dec 01 '22 00:12 shemeshg