Page 1 of 1

Associate pb Files to purebasic how to ?

Posted: Sun May 02, 2021 9:37 pm
by loulou2522
How do I associate PB files with Purebasic under Linux?

Re: Associate pb Files to purebasic how to ?

Posted: Mon May 03, 2021 12:24 pm
by ts-soft

Re: Associate pb Files to purebasic how to ?

Posted: Mon May 03, 2021 4:44 pm
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

Re: Associate pb Files to purebasic how to ?

Posted: Mon May 03, 2021 5:20 pm
by Keya
maybe add "sudo " ahead of the commandline instruction, to use admin priveleges which might be required

Re: Associate pb Files to purebasic how to ?

Posted: Mon May 03, 2021 5:40 pm
by mk-soft
I'm working without associate pb files und use a simple install of purebasic

Link: Simple Install of PureBasic (Ubuntu, Mint)

Re: Associate pb Files to purebasic how to ?

Posted: Mon May 03, 2021 5:48 pm
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:

Re: Associate pb Files to purebasic how to ?

Posted: Thu May 06, 2021 12:17 pm
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

Re: Associate pb Files to purebasic how to ?

Posted: Thu May 06, 2021 2:02 pm
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

Re: Associate pb Files to purebasic how to ?

Posted: Fri May 07, 2021 5:08 am
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