Solved: Linux Install

Everything else that doesn't fall into one of the other PB categories.
k3pto
User
User
Posts: 92
Joined: Sat Jan 17, 2015 5:24 pm

Solved: Linux Install

Post by k3pto »

I am very new to Linux Mint and have just installed Mint 22.3. I have downloaded PB for Ubunto 24. I can get PB to run if navigate to /compilers and double click on purebasic. However, if I add it to my Favorites and select it from there I get a pop up error message: This file is no longer available.

I am guessing I did something wrong in the way I installed it. I created a root folder named MyInstalls with a sub-folder PB-v630 and copied the contents of the .tgz file to /MyInstalls/PB-v630. Here is the contents of: Home/Larry/Desktop/PB-v630.desktop

[Desktop Entry]
Type=Application
Icon=/MyInstalls/PB-v630/logo.png
Name=PB-v630
Comment=Developer Utility
Exec=/MyInstalls/PB-v630/compilers/purebasic
Path=/MyInstalls/PB-v630/compilers
StartupNotify=false
Terminal=false
Last edited by k3pto on Tue Jan 20, 2026 9:30 pm, edited 1 time in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6506
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Linux Install

Post by mk-soft »

When all packages are installed, Purebasic should be able to execute this code (Compile/Run)

I wrote to myself to create the desktop file. After that you will find PB in Menu Developer again.

Code: Select all

;-TOP

#ProgramTitle = "Create PureBasic Desktop File"
#ProgramVersion = "v1.01.2 by mk-soft"

Enumeration Windows
  #Main
EndEnumeration

Enumeration MenuBar
  #MainMenu
EndEnumeration

Enumeration MenuItems
  #MainMenuAbout
  #MainMenuExit
EndEnumeration

Enumeration Gadgets
  #MainList
  #MainButtonSave
EndEnumeration

Enumeration StatusBar
  #MainStatusBar
EndEnumeration

; ----

Macro AddElementValue(List, Value)
  AddElement(List) : List = Value
EndMacro

Global NewList Rows.s()

Procedure CreateDesktopFile()
  Protected Name.s
  
  Name = "PureBasic v" + Str(#PB_Compiler_Version / 100) + "." + LSet(Str(#PB_Compiler_Version % 100), 2, "0")
  
  AddElementValue(Rows(), "[Desktop Entry]")
  AddElementValue(Rows(), "Type=Application")
  AddElementValue(Rows(), "Icon=" + #PB_Compiler_Home + "logo.png")
  AddElementValue(Rows(), "Name=" + Name + " (gtk3)")
  AddElementValue(Rows(), "Comment=Developer Utility")
  AddElementValue(Rows(), "Exec=" + #PB_Compiler_Home + "compilers/purebasic")
  AddElementValue(Rows(), "Path=" + #PB_Compiler_Home + "compilers")
  AddElementValue(Rows(), "StartupNotify=false")
  AddElementValue(Rows(), "Terminal=false")
  AddElementValue(Rows(), "Categories=Development")
  
  ForEach Rows()
    AddGadgetItem(#MainList, -1, Rows())
  Next

EndProcedure

Procedure SaveDesktopFile()
  Protected path.s, filename.s, file.s
  
  path = "/home/" + UserName() + "/.local/share/applications/"
  If FileSize(path) <> -2
    r1 = MessageRequester("Warning", "Path not exists. Create Path ?" + #LF$ + path, #PB_MessageRequester_Warning | #PB_MessageRequester_YesNo)
    If r1 <> #PB_MessageRequester_Yes
      ProcedureReturn 0
    EndIf
    If Not CreateDirectory(RTrim(path, "/"))
      r1 = MessageRequester("Error", "Create Path " + path, #PB_MessageRequester_Warning | #PB_MessageRequester_YesNo)
      ProcedureReturn 0
    EndIf
  EndIf
  filename = path + "purebasic-v" + LSet(Str(#PB_Compiler_Version), 3, "0") + ".desktop"
  
  file = SaveFileRequester("Save Desktop File", filename, "", 0)
  If file
    If CreateFile(0, file)
      ForEach Rows()
        WriteStringN(0, Rows())
      Next
      CloseFile(0)
    Else
      MessageRequester("Error", "File Not Saved!", #PB_MessageRequester_Error)
    EndIf
  EndIf
EndProcedure

; ----

Procedure UpdateWindow()
  Protected dx, dy
  dx = WindowWidth(#Main)
  dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
  ; Resize gadgets
  ResizeGadget(#MainList, 5, 5, dx - 10, dy - 45)
  ResizeGadget(#MainButtonSave, dx - 130, dy - 35, 120, 30)
EndProcedure

Procedure Main()
  Protected dx, dy
  
  #MainStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
  
  If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 800, 600, #ProgramTitle , #MainStyle)
    ; Menu
    CreateMenu(#MainMenu, WindowID(#Main))
    MenuTitle("&File")
    MenuItem(#MainMenuAbout, "About")
    MenuBar()
    MenuItem(#MainMenuExit, "E&xit")
    
    ; StatusBar
    CreateStatusBar(#MainStatusBar, WindowID(#Main))
    AddStatusBarField(#PB_Ignore)
    
    ; Gadgets
    dx = WindowWidth(#Main)
    dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
    ListViewGadget(#MainList, 5, 5, dx -10, dy - 45)
    ButtonGadget(#MainButtonSave, dx - 130, dy - 35, 120, 30, "Save")
    
    ; Bind Events
    BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
    
    CreateDesktopFile()
    
    ; Event Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case #Main
              Break
              
          EndSelect
          
        Case #PB_Event_Menu
          Select EventMenu()
            Case #MainMenuAbout
              MessageRequester("About", #ProgramTitle + #LF$ + #ProgramVersion, #PB_MessageRequester_Info)
                
            Case #MainMenuExit
              PostEvent(#PB_Event_CloseWindow, #Main, #Null)
              
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #MainList
              Select EventType()
                Case #PB_EventType_Change
                  ;
                  
              EndSelect
              
            Case #MainButtonSave
              SaveDesktopFile()
              
          EndSelect
          
      EndSelect
    ForEver
    
  EndIf
  
EndProcedure : Main()
P.S.
For desktop files on the desktop, the start authorization must be set.
But better place in the menu. Then add to the start bar with Context (right mouse).
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
k3pto
User
User
Posts: 92
Joined: Sat Jan 17, 2015 5:24 pm

Re: Linux Install

Post by k3pto »

Hi mk-soft,
Thank you for the very quick reply. Your program compiled, ran and created the file. How does Linux know where to find it?

I do not understand your sentences: "But better place in the menu. Then add to the start bar with Context (right mouse)." Right-clicking on the compiler does not have a "Context" option.
User avatar
NicTheQuick
Addict
Addict
Posts: 1554
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Linux Install

Post by NicTheQuick »

Why did you install PureBasic in some weird root folder like `/MyInstalls`? That's not how the Linux filesystem is meant to be used. Either install Purebasic into your home directory or in `/opt` but never somewhere directly into `/`. Personally I installed it in my home folder here: `/home/nicolas/apps/purebasic-XXX`.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
mk-soft
Always Here
Always Here
Posts: 6506
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Linux Install

Post by mk-soft »

k3pto wrote: Mon Jan 19, 2026 2:08 am Hi mk-soft,
Thank you for the very quick reply. Your program compiled, ran and created the file. How does Linux know where to find it?

I do not understand your sentences: "But better place in the menu. Then add to the start bar with Context (right mouse)." Right-clicking on the compiler does not have a "Context" option.
Of course, you must save the file to the suggested folder. "/home/[UserName]/.local/share/applications"
This is intended for user desktop files is then also displayed in the menu.
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
k3pto
User
User
Posts: 92
Joined: Sat Jan 17, 2015 5:24 pm

Re: Linux Install

Post by k3pto »

Hi Nic,
The main reason I put it in the MyInstalls folder is to be compatible with what I have done in Windows. I wanted to keep all my manually installed applications in one place to make them easier to find. Now with Linux, I would like to keep the same arrangement. I did not know about the /opt folder being allocated for the same reason - I am still learning about the Linux file system. Now that I know about /opt, I will probably move my installs over to it.

I do not want to store applications in my personal folders because they would then not be available to any other user of the PC unless I change the permissions.
k3pto
User
User
Posts: 92
Joined: Sat Jan 17, 2015 5:24 pm

Re: Linux Install

Post by k3pto »

Hi mk_soft,

I got it working. My issue had to do with upper/lower case entries. I am used to using Windows which does not care about case while Linux does.
User avatar
NicTheQuick
Addict
Addict
Posts: 1554
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Linux Install

Post by NicTheQuick »

k3pto wrote: Tue Jan 20, 2026 9:23 pm Hi Nic,
The main reason I put it in the MyInstalls folder is to be compatible with what I have done in Windows. I wanted to keep all my manually installed applications in one place to make them easier to find. Now with Linux, I would like to keep the same arrangement. I did not know about the /opt folder being allocated for the same reason - I am still learning about the Linux file system. Now that I know about /opt, I will probably move my installs over to it.

I do not want to store applications in my personal folders because they would then not be available to any other user of the PC unless I change the permissions.
Sure, if you need these applications to be available for other users, then it makes sense to put them outside the home directory.

To learn the basics of the Linux filesystem you could have a look into Wiki: https://en.wikipedia.org/wiki/Filesyste ... y_Standard
Or for the whole documentation: https://refspecs.linuxfoundation.org/FH ... index.html
Or this: https://www.geeksforgeeks.org/linux-uni ... structure/

It's good to know some basics or at least having heard of them.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply