Associate pb Files to purebasic how to ?

Linux specific forum
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Associate pb Files to purebasic how to ?

Post by loulou2522 »

How do I associate PB files with Purebasic under Linux?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Associate pb Files to purebasic how to ?

Post by ts-soft »

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

Re: Associate pb Files to purebasic how to ?

Post by loulou2522 »

Hi-Tsoft,
THanks for your answers. I use Linux Ubuntu 20 and Purebasic 73 LTS version on a virtual machine (virtual box)
The program you give me normally runs under terminal and in the Purebasic installation directory, with the command sh register.sh .The program runs without errors but the PB file assignments do not work in the output. Is there anything I'm not doing right because I'm a linux beginner?
It seems that Purebasic.xml won't be created
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Associate pb Files to purebasic how to ?

Post by Keya »

maybe add "sudo " ahead of the commandline instruction, to use admin priveleges which might be required
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Associate pb Files to purebasic how to ?

Post by mk-soft »

I'm working without associate pb files und use a simple install of purebasic

Link: Simple Install of PureBasic (Ubuntu, Mint)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Associate pb Files to purebasic how to ?

Post by Marc56us »

I don't full understand what you want, but, some tips:

1. Linux don't care about running direct or in a Virtual Machine (same)
2. There is no extension in unix file names, it is just a naming convention sometimes used by users used to Windows.
3. The graphical interface (XFCE, KDE, Gnome etc) is independent of the operating system (the kernel and the console tools). It uses a file convention to manage extensions if necessary.
4. In graphic mode, you can associate data file (so open IDE when double clic on .pb) with some program, like in Windows. To do that, left click on .pb and follow instruction on "open with..." and selec "other"
5. "associated" file does not work in console

:wink:
AZJIO
Addict
Addict
Posts: 1298
Joined: Sun May 14, 2017 1:48 am

Re: Associate pb Files to purebasic how to ?

Post by AZJIO »

x-user.xml file

Code: Select all

<?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>
    <generic-icon name="text-purebasic"/>
    <glob pattern="*.pb"/>
    <glob pattern="*.pbi"/>
    <glob pattern="*.pbf"/>
    <glob pattern="*.pbp"/>
   </mime-type>

</mime-info>
Run in the terminal

Code: Select all

sudo xdg-mime install x-user.xml
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: Associate pb Files to purebasic how to ?

Post by loulou2522 »

Thanks Azijo,
I mke whqt you do, but files where not assigned to PB. May be it provide from the fact i install purebasic manually and not with an automatic way.
Pure Basic is not recogniezd as an application in my virtual box.
Can you give me advise to help me in my problem ?
Thanks
AZJIO
Addict
Addict
Posts: 1298
Joined: Sun May 14, 2017 1:48 am

Re: Associate pb Files to purebasic how to ?

Post by AZJIO »

Manually
1. Make a catalog with PureBasic (/home/user/purebasic). It can be different, but take into account the path to the program in this instruction.
2. Create a settings directory and copy the settings files there (/home/user/.purebasic). Same as "С:\Users\user\AppData\Roaming\PureBasic". You don't have to customize the color theme, etc., every time.
3. Copy the /home/user/purebasic/logo.png icon to /usr/share/pixmaps (You can change the path in the shortcut Icon=/home/user/purebasic/logo.png)
4. Create a shortcut to the program in the "/usr/share/applications/PureBasic.desktop" (And on the desktop)

Code: Select all

[Desktop Entry]
Type=Application
Name=PureBasic
GenericName=PureBasic
Exec=/home/user/purebasic/compilers/purebasic %F
Terminal=false
Icon=/usr/share/pixmaps/purebasic.png
Categories=Development;Utility;IDE;
Comment=PureBasic development environment
Comment[ru]=Среда разработки PureBasic
MimeType=text/purebasic
5. Create an icon "text-purebasic.png" in the "/home/user/.icons" (/home/user/.icons/Faenza/mimetypes/16/text-purebasic.png)
Run the command to link the files to the program I pointed out in the previous post. You may need to install the xdg-utils package.

6. Open /home/user/.config/mimeapps.list. Add lines:

Code: Select all

[Default Applications]
text/purebasic=purebasic.desktop

[Added Associations]
text/purebasic=purebasic.desktop;geany.desktop;xed.desktop;
There are already sections, you just need to add a type and a shortcut to them (type=shortcut or type=shortcut1;shortcut2;shortcut3;). Here you list the programs that will be offered to open in them (Code highlighting in Geany).

7. Copy language to /home/user/purebasic/catalogs

That's it, finished
Post Reply