PureBasic quit unexpectedly

Mac OSX specific forum
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

PureBasic quit unexpectedly

Post by Distorted Pixel »

Hi,

My images aren't loading here to show, maybe I should use my other cloud service, but below are word explanations of what is happening. If someone needs me to show the images I can upload them to my other cloud service and maybe they will show here.

I am new to Mac OS X programming, I'm a PC programmer, but I'm trying to expand my programs to multiple devices. I have 5.73 LTS version on my MacBook Air running Monteray 12.1. Hard drive is small so I have a 2TB external SSD connected. I keep getting the following things happening when I start PureBasic up and quit after I save everything.

I get this when I start PureBasic up the next time after I have saved a project during the previous time
"A previous IDE session seems to have ended improperly"
It gives me the opportunity to open a session if I want to save, but it won't do anything after you select any session listed.

This is what I get after I save the project and exit PureBasic
"A Problem Report for PureBasic" is what is says at the top of a generated report and at the bottom I have the option to click "Ok" or "ReOpen"

How can I resolve this or can someone help me make sure PureBasic is setup right?
The debbuger also tells me my images don't exist when they do. I believe I have the path corrent in the program
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PureBasic quit unexpectedly

Post by mk-soft »

This is a known bug that should be fixed in the next version.

Current solutions:
1. Switch off the history under settings

2. Replace the IDE in PureBasic.app with a repaired version from me.

Go to the app with the right mouse button and display the package content. The programme is stored under PureBasic.app/Contents/MacOS.

Download Link: My Cloud OneDrive

---
The debbuger also tells me my images don't exist when they do. I believe I have the path corrent in the program
For this we need some code. With macOS, the path is a little different than with windows.
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
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: PureBasic quit unexpectedly

Post by Distorted Pixel »

For this we need some code. With macOS, the path is a little different than with windows./quote]

Thank you, I think the IDE replacement helped. I changed the history setting too
I don't have anything inside the Repeat Until loop yet.

[img]https://mega.nz/file/I5dmgR5A#5UMWKqg45 ... -kCRfI/img]

Code: Select all

Procedure PlayerNumberSelection()
    
  If OpenWindow(0, 0, 0, 1440, 810, "")
    ImgFile = LoadImage(#PB_Any,"/Volumes/untitled 1/PureBasic Projects/ Ultimate Football Manager/Media/football1.png")
    Window = OpenWindow(#PB_Any, x, y, 1440, 810, "", #PB_Window_BorderLess)
    ImageGadget(#PB_Any, 0, 0, 1440, 810, ImageID(ImgFile))
    
   Repeat
      Event = WaitWindowEvent()
      
      
    Until Event = #PB_Event_CloseWindow 
      
  EndIf
   
 EndProcedure/code]
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PureBasic quit unexpectedly

Post by mk-soft »

Check your path with

Code: Select all

path.s = OpenFileRequester("", "", "", 0)
Debug path
Do you want to start a folder name with a blank character?

P.S.
If you have changed the IDE, the history will also work.
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
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: PureBasic quit unexpectedly

Post by Distorted Pixel »

mk-soft wrote: Sat Jan 01, 2022 12:24 pm Check your path with

Code: Select all

path.s = OpenFileRequester("", "", "", 0)
Debug path
I will give the requester code a try

Do you want to start a folder name with a blank character?
If you are referring to the double quotes I have in my procedure, that is where the window title goes and I didn't want a title.
I actually want everything to be full screen at some point and not have any window borders
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: PureBasic quit unexpectedly

Post by Distorted Pixel »

I have figured out my issue why it was saying the image didn't exist. I had a space between "/" and the next word in the directory path and obviously there can't be a space.

Now on to getting the images to show up. Images aren't showing up LOL and I'm working on getting the mouse click to be detected. I'm finding out that a lot of commands depend on others to be before them just to get the mouse detection to work ugh LOL
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: PureBasic quit unexpectedly

Post by Distorted Pixel »

Things are starting to fall into place. I'm slowly figuring things out. I have one image showing now and I'm working on the one before it which is the splash screen.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PureBasic quit unexpectedly

Post by mk-soft »

As you can see, in macOS an application is a folder with a fixed structure. (MyApp.app)
This means that additional files belong in this folder.
These must be copied in after compiling and before starting.
To do this, I wrote an IDE tool, which I then added twice in the PB IDE in tools.

IDE-Tool MyAppdata

As with Windows and Linux, user settings are not stored in the program folder. They belong in fixed folders.

Code: Select all

;-TOP

; Comment: Path Helper v1.03 by mk-soft

; Change names
#CompanyName = "mk-soft"
#ApplicationName = "MyApplication"

CompilerIf #PB_Compiler_OS
  
  Macro CocoaString(NSString)
    PeekS(NSString, -1, #PB_UTF8)
  EndMacro
  
CompilerEndIf

Procedure.s GetProgramPath()
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    Static bundlePath.s
    Protected bundlePathPtr
    
    If Not Bool(bundlePath)
      bundlePathPtr = CocoaMessage(0,CocoaMessage(0,CocoaMessage(0,0,"NSBundle mainBundle"),"bundlePath"),"UTF8String")
      If bundlePathPtr
        bundlePath = CocoaString(bundlePathPtr) + "/"
      EndIf
    EndIf
    ProcedureReturn bundlePath
  CompilerElse
    ProcedureReturn GetPathPart(ProgramFilename())  
  CompilerEndIf
EndProcedure

; ----

Procedure.s GetResourcePath()
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    Static resourcePath.s
    Protected resourcePathPtr
    
    If Not Bool(resourcePath)
      resourcePathPtr = CocoaMessage(0,CocoaMessage(0,CocoaMessage(0,0,"NSBundle mainBundle"),"resourcePath"),"UTF8String")
      If resourcePathPtr
        resourcePath = CocoaString(resourcePathPtr) + "/"
      EndIf
    EndIf
    ProcedureReturn resourcePath
  CompilerElse
    ProcedureReturn GetProgramPath() + "Resources" + #PS$
  CompilerEndIf
EndProcedure

; ----

Procedure.s GetLibraryPath()
  Protected librayPath.s
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    librayPath = GetProgramPath() + "Contents/Library/"
  CompilerElse
    librayPath = GetProgramPath() + "Library" + #PS$
  CompilerEndIf
  ProcedureReturn librayPath
EndProcedure

; ----

Procedure.s GetProgramDataPath()
  Protected basePath.s, subPath.s, dataPath.s
  
  CompilerIf #PB_Compiler_OS = #PB_OS_Linux
    basePath = GetHomeDirectory()
    subPath = basePath + "." + #CompanyName + #PS$
  CompilerElse
    basePath = GetUserDirectory(#PB_Directory_ProgramData)
    subPath = basePath + #CompanyName + #PS$
  CompilerEndIf
  dataPath = subPath + #ApplicationName + #PS$
  If FileSize(dataPath) <> -2
    If FileSize(subPath) <> -2
      CreateDirectory(subPath)
    EndIf
    If FileSize(dataPath) <> -2
      CreateDirectory(dataPath)
    EndIf
  EndIf
  ProcedureReturn dataPath
EndProcedure

; ----

Procedure.s GetAllUserDataPath()
  Protected basePath.s, subPath.s, dataPath.s
  
  basePath = GetUserDirectory(#PB_Directory_AllUserData)
  subPath = basePath + #CompanyName + #PS$
  dataPath = subPath + #ApplicationName + #PS$
  If FileSize(dataPath) <> -2
    If FileSize(subPath) <> -2
      CreateDirectory(subPath)
    EndIf
    If FileSize(dataPath) <> -2
      CreateDirectory(dataPath)
    EndIf
  EndIf
  ProcedureReturn dataPath
EndProcedure

; ****

CompilerIf #PB_Compiler_IsMainFile
  Debug "Program Path: " + GetProgramPath()
  Debug "Program Resources Path: " + GetResourcePath()
  Debug "Program Libraries Path: " + GetLibraryPath()
  Debug "Program Data Path: " + GetProgramDataPath()
  Debug "Program Alluser Data Path: " + GetAllUserDataPath()
CompilerEndIf
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
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: PureBasic quit unexpectedly

Post by Distorted Pixel »

mk-soft wrote: Sun Jan 02, 2022 1:33 pm As you can see, in macOS an application is a folder with a fixed structure. (MyApp.app)
This means that additional files belong in this folder.
These must be copied in after compiling and before starting.
To do this, I wrote an IDE tool, which I then added twice in the PB IDE in tools.

IDE-Tool MyAppdata

As with Windows and Linux, user settings are not stored in the program folder. They belong in fixed folders.

Code: Select all

;-TOP

; Comment: Path Helper v1.03 by mk-soft

; Change names
#CompanyName = "mk-soft"
#ApplicationName = "MyApplication"

CompilerIf #PB_Compiler_OS
  
  Macro CocoaString(NSString)
    PeekS(NSString, -1, #PB_UTF8)
  EndMacro
  
CompilerEndIf

Procedure.s GetProgramPath()
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    Static bundlePath.s
    Protected bundlePathPtr
    
    If Not Bool(bundlePath)
      bundlePathPtr = CocoaMessage(0,CocoaMessage(0,CocoaMessage(0,0,"NSBundle mainBundle"),"bundlePath"),"UTF8String")
      If bundlePathPtr
        bundlePath = CocoaString(bundlePathPtr) + "/"
      EndIf
    EndIf
    ProcedureReturn bundlePath
  CompilerElse
    ProcedureReturn GetPathPart(ProgramFilename())  
  CompilerEndIf
EndProcedure

; ----

Procedure.s GetResourcePath()
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    Static resourcePath.s
    Protected resourcePathPtr
    
    If Not Bool(resourcePath)
      resourcePathPtr = CocoaMessage(0,CocoaMessage(0,CocoaMessage(0,0,"NSBundle mainBundle"),"resourcePath"),"UTF8String")
      If resourcePathPtr
        resourcePath = CocoaString(resourcePathPtr) + "/"
      EndIf
    EndIf
    ProcedureReturn resourcePath
  CompilerElse
    ProcedureReturn GetProgramPath() + "Resources" + #PS$
  CompilerEndIf
EndProcedure

; ----

Procedure.s GetLibraryPath()
  Protected librayPath.s
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    librayPath = GetProgramPath() + "Contents/Library/"
  CompilerElse
    librayPath = GetProgramPath() + "Library" + #PS$
  CompilerEndIf
  ProcedureReturn librayPath
EndProcedure

; ----

Procedure.s GetProgramDataPath()
  Protected basePath.s, subPath.s, dataPath.s
  
  CompilerIf #PB_Compiler_OS = #PB_OS_Linux
    basePath = GetHomeDirectory()
    subPath = basePath + "." + #CompanyName + #PS$
  CompilerElse
    basePath = GetUserDirectory(#PB_Directory_ProgramData)
    subPath = basePath + #CompanyName + #PS$
  CompilerEndIf
  dataPath = subPath + #ApplicationName + #PS$
  If FileSize(dataPath) <> -2
    If FileSize(subPath) <> -2
      CreateDirectory(subPath)
    EndIf
    If FileSize(dataPath) <> -2
      CreateDirectory(dataPath)
    EndIf
  EndIf
  ProcedureReturn dataPath
EndProcedure

; ----

Procedure.s GetAllUserDataPath()
  Protected basePath.s, subPath.s, dataPath.s
  
  basePath = GetUserDirectory(#PB_Directory_AllUserData)
  subPath = basePath + #CompanyName + #PS$
  dataPath = subPath + #ApplicationName + #PS$
  If FileSize(dataPath) <> -2
    If FileSize(subPath) <> -2
      CreateDirectory(subPath)
    EndIf
    If FileSize(dataPath) <> -2
      CreateDirectory(dataPath)
    EndIf
  EndIf
  ProcedureReturn dataPath
EndProcedure

; ****

CompilerIf #PB_Compiler_IsMainFile
  Debug "Program Path: " + GetProgramPath()
  Debug "Program Resources Path: " + GetResourcePath()
  Debug "Program Libraries Path: " + GetLibraryPath()
  Debug "Program Data Path: " + GetProgramDataPath()
  Debug "Program Alluser Data Path: " + GetAllUserDataPath()
CompilerEndIf
I always thought that the ".app" was the execution file extension like in Windows ".exe". I didn't know it was a a folder with a fixed structure.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
Post Reply