Page 2 of 2

Re: Register extensions and make menu-entry for PB

Posted: Sun May 28, 2017 8:01 pm
by ts-soft
fryquez wrote:If I run the Purebasic 5.60 included register.sh on my Ubuntu Mate 17.04,
I get an error: register.sh: 36: [: unexpected operator
I think, you have used anotherone :wink:
Change:

Code: Select all

echo "[Desktop Entry]
to

Code: Select all

echo "[Desktop Entry]"

Re: Register extensions and make menu-entry for PB

Posted: Sun May 28, 2017 8:40 pm
by fryquez
Hi ts-soft,

no the included one in Purebaisc 5.60 is following one:

Code: Select all

#!/bin/bash

# Goto home
cd $HOME
# Make sure, dir exist
mkdir -p .local/share/mime/packages
# change to dir for purebasic.xml
cd .local/share/mime/packages
# purebasic.xml create
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > purebasic.xml
echo "<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>" >> purebasic.xml
echo "   <mime-type type=\"text/purebasic\">" >> purebasic.xml
echo "      <comment>PureBasic source code</comment>" >> purebasic.xml
echo "      <glob pattern=\"*.pb\"/>" >> purebasic.xml
echo "      <glob pattern=\"*.pbi\"/>" >> purebasic.xml
echo "      <glob pattern=\"*.pbf\"/>" >> purebasic.xml
echo "   </mime-type>" >> purebasic.xml
echo "</mime-info>" >> purebasic.xml

# change to home
cd $HOME
# Make sure, dir exist
mkdir -p .local/share/applications
# change to dir for PureBasic.desktop
cd .local/share/applications
# PureBasic.desktop create
echo "[Desktop Entry]" > PureBasic.desktop
echo "Comment=PureBasic IDE" >> PureBasic.desktop
echo "Terminal=false" >> PureBasic.desktop
echo "Name=PureBasic" >> PureBasic.desktop
echo "Type=Application" >> PureBasic.desktop
echo "MimeType=text/purebasic" >> PureBasic.desktop
echo "Categories=Development;" >> PureBasic.desktop
echo "StartupNotify=true" >> PureBasic.desktop
# check environment var
if [ "$PUREBASIC_HOME" == "" ]
then
   echo "Exec=${HOME}/purebasic/compilers/purebasic" >> PureBasic.desktop
   echo "Icon=${HOME}/purebasic/logo.png" >> PureBasic.desktop
else
   echo "Exec=${PUREBASIC_HOME}/compilers/purebasic" >> PureBasic.desktop
   echo "Icon=${PUREBASIC_HOME}/logo.png" >> PureBasic.desktop
fi

# Update Databases
update-desktop-database ~/.local/share/applications
update-mime-database    ~/.local/share/mime
echo "File extensions .pb, .pbi, .pbf are now registered for PureBasic."
so line 36 is: "if [ "$PUREBASIC_HOME" == "" ]"
Not sure why it complains about the bracket, removing it doesn't help either.

Re: Register extensions and make menu-entry for PB

Posted: Mon Apr 02, 2018 12:57 pm
by loulou2522
Same problem on UBUNTU 17.10 and the sh file seems not executing
THe extension is not registered / Can someone help me to solve this problem

Re: Register extensions and make menu-entry for PB

Posted: Thu Mar 12, 2020 1:56 pm
by pwillard
regarding: if [ "$PUREBASIC_HOME" == "" ]

remove the quotes

if [ $PUREBASIC_HOME == "" ]

Re: Register extensions and make menu-entry for PB

Posted: Thu Mar 12, 2020 2:15 pm
by Fred
Moved to bug report

Re: Register extensions and make menu-entry for PB

Posted: Fri Mar 13, 2020 4:14 pm
by pwillard
Actually, I went back to trying this same fix on default 5.62 and it complained.


This format below worked, Change line 36 to:

Code: Select all

if [ -z "$PUREBASIC_HOME" ] 
Which is a slightly better way to check to see if that variable is defined or if it is 'null' anyway.