Therefore start the pb ide with a script and create a desktop file.
In addition, create a tool app to start the compiler with the correct path.
Create script run_pb.sh
Save under /home/Apps/[UserName]
Set the permission to run as a program
Code: Select all
#!/bin/bash
# Test mandatory PureBasic path parameter
if [ -z "$1" ]; then
echo "Invalid parameters: Missing argument for target PureBasic directory"
exit 1
fi
# Set PUREBASIC_HOME and ensure compiler and IDE are in the PATH
export PUREBASIC_HOME=$1
export PATH="$PUREBASIC_HOME/compilers:$PUREBASIC_HOME:$PATH"
# Test if the PureBasic home is valid and check if this is PB or SB
if [ -f "$PUREBASIC_HOME/compilers/pbcompiler" ]; then
echo "Start purebasic ide"
purebasic
else
echo "Invalid path for target PureBasic directory"
exit 1
fi
Adjust Path to PureBasic.
Code: Select all
[Desktop Entry]
Type=Application
Icon=/home/michael/Apps/purebasic-v620/logo.png
Name=PureBasic v6.20 (gtk3)
Comment=Developer Utility
Categories=Development
Exec=/home/michael/Apps/run_pb.sh /home/michael/Apps/purebasic-v620
Path=/home/michael/Apps/purebasic-v620/compilers
StartupNotify=true
Terminal=false
Code: Select all
;-TOP
Global home.s, compiler.s, pbfile.s, libname.s, id, r1.s
pbfile = ProgramParameter(0)
libname = GetFilePart(pbfile, #PB_FileSystem_NoExtension)
compiler = "pbcompilerc"
If MessageRequester("Build Libray", "File: " + pbfile, #PB_MessageRequester_YesNo) <> #PB_MessageRequester_Yes
End
EndIf
id = RunProgram(compiler, pbfile + " --optimizer --purelibrary --output " + libname, "", #PB_Program_Open | #PB_Program_Read)
If Not id
MessageRequester("Error", "Compiler not found: " + #LF$ + compiler)
End
EndIf
While ProgramRunning(id)
If AvailableProgramOutput(id)
r1 + ReadProgramString(id) + #CRLF$
EndIf
Wend
CloseProgram(id)
MessageRequester("Result:", r1)
