Forums

Wiki Update: POL Syntax

Auteur Réponses
kreyren Dimanche 30 Décembre 2018 à 18:09
kreyren

http://wiki.playonlinux.com/index.php/Scripting_-_Chapter_1:_Getting_to_know_Bash#Requirements_of_every_script required update.

Is this sufficient?

 

<pre class="code playonlinux">

#!/usr/bin/env playonlinux-bash

if [[ $PLAYONLINUX=="" ]]; then
exit 0
echo "TODO: $PLAYONLINUX variable is empty" # TODO: Why is var required not empty?
 
else
source "$PLAYONLINUX/lib/sources"
fi
 
POL_SetupWindow_Init # Initiates Setup Window
 
POL_SetupWindow_Close # Closes Setup Window
 
exit
 
</pre>

Edité par kreyren

kreyren Dimanche 30 Décembre 2018 à 18:11
kreyren

Requires more info to line 3:

 `echo "TODO: $PLAYONLINUX variable is empty" # TODO: Why is var required not empty?`

Quentin PÂRIS Dimanche 30 Décembre 2018 à 21:12
Quentin PÂRISAnonymous

In fact we used to encourage the usage of a long code, but at the end it does not happen often. So to make the code more readable, we prefer being more concise

kreyren Dimanche 30 Décembre 2018 à 22:57
kreyren

Noted, can you elaborate on PLAYONLINUX variable? Meaning what does it mean?

My abstract is to rather make `if [[ $PLAYONLINUX = <Game_name> ]]; then` ....

Quentin PÂRIS Lundi 31 Décembre 2018 à 0:18
Quentin PÂRISAnonymous

$PLAYONLINUX is just a variable that contains the path of the lib/ folder in PlayOnLinux installation. It is required to have access to POL_SetupWindow_* commands, and the script is just checking that this variable exist, so we are sure that we are inside a PlayOnLinux context

kreyren Lundi 31 Décembre 2018 à 18:20
kreyren

So is using:

`PLAYONLINUX="/usr/share/playonlinux/lib" ` sane or is there any scenario in which it would be empty?