It is currently Fri Jun 22, 2018 12:58 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Register extensions and make menu-entry for PB
PostPosted: Wed May 21, 2014 7:50 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5736
Location: Berlin - Germany
This small script register mime-type for: *.pb, *.pbi, *.pbf and make a menu-entry on any
freedesktop.org compatible distribution (tested on ubuntu, CentOS and some others)!

Before you can use this script, you have to install purebasic with methode 1, described in install.

Script:
Code:
#!/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
# 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

After saving, don't forget to make the script executable and run it as user (no root required!)

Download script

Greetings - Thomas

// Update:
you will find this script in your purebasic-dir (>=PB540B9) as "register.sh" :wink:

_________________
PureBasic 5.70 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 19.0 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Last edited by ts-soft on Sat Oct 10, 2015 12:30 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Wed May 21, 2014 9:43 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3252
Location: New Zealand
nice one. I should make this sticky

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=D5iX9YhCCp8


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Wed May 21, 2014 10:18 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5736
Location: Berlin - Germany
you're welcome :D
idle wrote:
I should make this sticky
Please, do it :wink:

_________________
PureBasic 5.70 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 19.0 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Fri May 23, 2014 9:12 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5736
Location: Berlin - Germany
Update:
Uses envvar "PUREBASIC_HOME", if var was set.

_________________
PureBasic 5.70 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 19.0 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Fri Nov 28, 2014 11:49 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3147
Location: Berlin, Germany
Very useful.
Thanks a lot, Thomas :!:

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Thu Sep 03, 2015 1:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Jul 25, 2003 11:24 pm
Posts: 532
That's quite a script! I copied it to a file I named PBlinker.sh. Now I am going to have to make time to go through it and make sure it is compatible with my PureBasic tree of folders. I'm forced to arrange things by folders just to get some sence of order to everything I have downloaded from several sites. I really appreciate your having gone to all this effort!

_________________
has-been wanna-be (You may not agree with what I say, but it will make you think).


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 2:11 am 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1459
Location: North by Northwest
Awesome :!:

Added one more entry:
Code:
echo "StartupNotify=true" >> PureBasic.desktop

just before:
Code:
# check environment var


With this addition you can add PureBasic to your favorites in GNOME 3 :mrgreen:
(mouse/trackpad right click on PureBasic icon inside favorites bar while app is running...)

Sweet 8)

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 1:41 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13304
Location: France
Do you mind if I include it in the PB package ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 2:00 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5736
Location: Berlin - Germany
Please, do it. It's make the installation easier and more comfortable!

After over 1 year testing, it work's with all distris, i have used.

_________________
PureBasic 5.70 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 19.0 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 2:25 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13304
Location: France
Should it be run automatically in the ./launch script, or should it be a seperate file ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 3:11 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5736
Location: Berlin - Germany
I think, a seperate file is better.

_________________
PureBasic 5.70 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 19.0 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Mon Sep 28, 2015 3:19 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13304
Location: France
Ok, thanks. Added for the next beta :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Sun Oct 18, 2015 12:54 pm 
Offline
User
User
User avatar

Joined: Mon Apr 04, 2011 3:56 am
Posts: 53
Location: Russia,Angarsk
If the script is in the folder distribution
Code:
# 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

Can be replaced by
Code:
#!/bin/bash
 
ABSOLUTE_FILENAME=`readlink -e "$0"`
DIRECTORY=`dirname "$ABSOLUTE_FILENAME"`

# 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 "Exec=${DIRECTORY}/compilers/purebasic" >> PureBasic.desktop
echo "Icon=${DIRECTORY}/logo.png" >> PureBasic.desktop

# Update Databases
update-desktop-database ~/.local/share/applications
update-mime-database    ~/.local/share/mime

_________________
Linux Mint Maya(Mate), x86, PureBasic 5.00(5.10b1)


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Thu Jan 12, 2017 12:42 pm 
Offline
User
User

Joined: Thu Sep 06, 2012 9:39 am
Posts: 57
Added *.pbp to the list of extensions and cleaned ts-soft's version a bit:
Code:
#!/bin/bash

###############################################################################
DIR_MIME=".local/share/mime"
FILE_MIME="purebasic.xml"

# go home
cd $HOME

# make sure dir exist
mkdir -p $DIR_MIME/packages

# change dir
cd $DIR_MIME/packages

# create extension.xml
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">
   <mime-type type=\"text/purebasic\">
      <comment>PureBasic source code</comment>
      <glob pattern=\"*.pb\"/>
      <glob pattern=\"*.pbi\"/>
      <glob pattern=\"*.pbf\"/>
      <glob pattern=\"*.pbp\"/>
   </mime-type>
</mime-info>" > $FILE_MIME

###############################################################################
DIR_APPS=".local/share/applications"
FILE_APPS="PureBasic.desktop"

# go home
cd $HOME

# make sure dir exist
mkdir -p $DIR_APPS

# change dir
cd $DIR_APPS

# create application.desktop
echo "[Desktop Entry]
Comment=PureBasic IDE
Terminal=false
Name=PureBasic
Type=Application
MimeType=text/purebasic
Categories=Development;
StartupNotify=true" > $FILE_APPS

# check environment var
if [ "$PUREBASIC_HOME" == "" ]
then
   echo "Exec=${HOME}/purebasic/compilers/purebasic" >> $FILE_APPS
   echo "Icon=${HOME}/purebasic/logo.png" >> $FILE_APPS
else
   echo "Exec=${PUREBASIC_HOME}/compilers/purebasic" >> $FILE_APPS
   echo "Icon=${PUREBASIC_HOME}/logo.png" >> $FILE_APPS
fi

chmod +x $FILE_APPS
###############################################################################

# update databases
update-mime-database ~/$DIR_MIME
update-desktop-database ~/$DIR_APPS

echo "File extensions (.pb, .pbi, .pbf, .pbp) are now registered for PureBasic"


Top
 Profile  
Reply with quote  
 Post subject: Re: Register extensions and make menu-entry for PB
PostPosted: Sun May 28, 2017 7:31 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Dec 21, 2015 8:12 pm
Posts: 115
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye