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

Linux scripts incorrectly treat relative paths #1

Open
renatoathaydes opened this issue Jun 3, 2020 · 3 comments
Open

Linux scripts incorrectly treat relative paths #1

renatoathaydes opened this issue Jun 3, 2020 · 3 comments

Comments

@renatoathaydes
Copy link

I've just downloaded the Sciter SDK and tried to run Quark on Ubuntu. It doesn't work because the relative paths are not treated correctly.

Here's your current Linux script:

../../bin.lnx/x64/scapp ../../quark/index.htm

This only works if I run it from sdk_path/bin.quark/linux.

To make it work from anywhere, it should look like this:

#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

"$DIR/../../bin.lnx/x64/scapp" "$DIR/../../quark/index.htm"

It's also necessary to chmod scapp (which is not mentioned in the tutorial at http://quark.sciter.com/quark-application-samples/hello-world/) but now it works.

One hint: if you pack the application in a tar ball, file permissions should be preserved, so users wouldn't need to chmod it (but I assume you need to do it from Linux/MacOS, not Windows).

@c-smile
Copy link
Collaborator

c-smile commented Jun 3, 2020

Thanks.

I've mentioned chmod in the note in "3. Run Quark from Sciter SDK"

And your bash script does not work on Linux/Mint here. I am getting this (never seen anything like that before):

Error

@renatoathaydes
Copy link
Author

It should work fine on Mint, I used to use Mint before, it's just a derivate of Ubuntu. The script I posted, in fact, should work in any Linux distro I know of, it's just bash!

@renatoathaydes
Copy link
Author

renatoathaydes commented Jun 3, 2020

See https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself

As people mention there, this is much simpler, but should also work in the majority of cases:

DIR=$(dirname "$0")

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

No branches or pull requests

2 participants