rorywalsh/cabbage

[Linux] Default install to /usr/local/bin

Opened this issue · 6 comments

When one runs the install-script it should default to /usr/local/bin

Currently /usr/bin is used which is really bad practice. This is reserved for distro package manager installs and should never be used by third parties.
Also if one chooses to install to an alternate directory a lot of functionality fails because paths have been hard-coded internally to /usr/bin.

There is also a file opcodes.txt installed to the bin dir, which doesn't make any sense.

Please correct these issues.

These are all good points. I typically run Cabbage out of the build directory myself so never have to worry about this. Do you feel like making a PR for a better install script? I'd be happy to merge. How about the other resources (examples/documentation.etc), are they going into an acceptable location?

No everything is currently going to reserved locations where they should be going to /usr/local as well.

Simply changing the install script won't work, because the applications have their internal locations hardcoded to /usr/bin path.
For instance if one wants to export a project, it will fail because it is expecting /usr/bin/CabbagePlugin. Maybe instead of the full path just the application-name should be used. Because these should already be in the $PATH of the user.

So I can just use the location of the current binary to set the path for the plugins, like I do on other platforms. So basically scrap the if !def...

        String pluginFilename, fileExtension;
        File thisFile = File::getSpecialLocation (File::currentApplicationFile);
#if !defined(WIN32) && !defined(MACOSX)
        String currentApplicationDirectory = "/usr/bin";
#else
        String currentApplicationDirectory = thisFile.getParentDirectory().getFullPathName();
#endif

After that we only need to ensure that the plugins are in the same folder as the main application binary.

You shouldn't even need to think about the location of the binaries. If the user installed Cabbage, then all the Cabbage binaries are in the $PATH already.

You should only have to call the binary name. The full path is irrelevant.

(but maybe someone else needs to chime in on this :) )

It should be simple enough to test. I won't be at my Linux machine for a few days, but if you wish to go ahead and test this I'd be more than happy to hear how it goes 👍

I don't have time today to try and build Cabbage, but thanks for looking in to this :)