Register extensions and make menu-entry for PB

Linux specific forum
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Register extensions and make menu-entry for PB

Post 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]"
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: Register extensions and make menu-entry for PB

Post 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.
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: Register extensions and make menu-entry for PB

Post 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
User avatar
pwillard
New User
New User
Posts: 8
Joined: Wed Jan 16, 2013 4:49 pm
Location: Atlanta, USA
Contact:

Re: Register extensions and make menu-entry for PB

Post by pwillard »

regarding: if [ "$PUREBASIC_HOME" == "" ]

remove the quotes

if [ $PUREBASIC_HOME == "" ]
- It's not the language, it's the programmers
Image
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Register extensions and make menu-entry for PB

Post by Fred »

Moved to bug report
User avatar
pwillard
New User
New User
Posts: 8
Joined: Wed Jan 16, 2013 4:49 pm
Location: Atlanta, USA
Contact:

Re: Register extensions and make menu-entry for PB

Post 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.
- It's not the language, it's the programmers
Image
Post Reply