Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin source folder is wrong and doesn't work #8

Open
TuxVinyards opened this issue Feb 7, 2024 · 3 comments
Open

Plugin source folder is wrong and doesn't work #8

TuxVinyards opened this issue Feb 7, 2024 · 3 comments

Comments

@TuxVinyards
Copy link

As you have now opened an Issues section, I refer you to my comment made a while back:

(f6f06a4#comments)

" The plugin folder is in the wrong place. This should be in '/usr/share' not '/usr/bin'. "

$BASH_SOURCE will return "/usr/bin" as this is where Quickemu and Quickget are located. Only key single files should be there. The other files and folders should go in "/usr/share".

See https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard for more details.

" Also have a look at how I have done things with qqX. Version 1.6 published about an hour ago. The main file will look in the current folder, for Dev purposes, but will default to FHS norms otherwise."

# Find where the main code is. Use local for Dev or Custom installs. Otherwise use FHS standard locations.

qqX_MainFolder="/usr/share/qqX/qqX.main"

[[ -d "./qqX.main" ]] &&  qqX_MainFolder="$(realpath "./qqX.main")"

if [[ ! -d "$qqX_MainFolder" ]]; then echo; echo "  ERROR: qqX main files not found.  Please re-check your installation."; echo; sleep 10; exit 1 ; fi

(https://github.com/TuxVinyards/qqX/blob/main/qqX)

@TuxVinyards TuxVinyards changed the title Plugin source folder is plain wrong & also doesn't work Plugin source folder is wrong Feb 7, 2024
@TuxVinyards TuxVinyards changed the title Plugin source folder is wrong Plugin source folder is wrong and doesn't work Feb 7, 2024
@TuxVinyards
Copy link
Author

BASE_DIR="${BASH_SOURCE[0]%%/*}" doesn't work.

Try this:

#!/bin/bash

echo "BASH_SOURCE = $BASH_SOURCE"

declare -p BASH_SOURCE

BASE_DIR="${BASH_SOURCE[0]%%/*}"

echo "BASE_DIR = $BASE_DIR"

BASE_DIR="$(dirname "$BASH_SOURCE")"

echo "BASE_DIR = $BASE_DIR"

read -rp "  >   "

@TuxVinyards
Copy link
Author

TuxVinyards commented Feb 8, 2024

👍

Small typo amend needed though.

BASE_DIR="$(dirname "${BASEDIR_SOURCE}")" > BASE_DIR="$(dirname "${BASH_SOURCE[0]}")"

Also bear in mind that as $BASEDIR_SOURCE is an empty non-existent variable,
BASE_DIR="$(dirname "${BASEDIR_SOURCE}")" will always return ' . '

It's the same as using dirname " " so you will have to re-jig your if-then tests a bit too.

My bad, BTW on pasting up a shorthand "$BASH_SOURCE" in the test script, so it ended up getting transferred.

Screenshot at 2024-02-08 16-18-29

We have enough shellcheck warnings to contend with in the quickget script already, without adding any more.

🚀

@TuxVinyards
Copy link
Author

@dabrown645 There's a bit of a discussion going on that you may wish to have a look at, on your refactor and that of @lj3954 In particular, you may like to address some of the technical issues that @lj3954 has raised.

TuxVinyards/qqX#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant