Mac Newbie problems

Mac OSX specific forum
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Mac Newbie problems

Post by GedB »

Hi All,

Returning to PB on the Mac after a few years of Windows use.

I'm hitting some teething problems and I was hoping that somebody could help me.

1) I have the following code that just keeps failing. I select the file then it fails to open:

Code: Select all

FilePath.s = OpenFileRequester("Open File", "", "", 0)

If ReadFile(0, FilePath) > 0
  Line.s = ReadString(0)
  Debug(HeaderLine)
  CloseFile(0)
Else  
  Debug "Could not open " + FilePath
EndIf


2) If I create an excecutable and then try to open it in finder nothing happens.

I appreciate any help you can give me.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Mac Newbie problems

Post by wilbert »

GedB wrote:1) I have the following code that just keeps failing. I select the file then it fails to open:

Code: Select all

FilePath.s = OpenFileRequester("Open File", "", "", 0)

If ReadFile(0, FilePath) > 0
  Line.s = ReadString(0)
  Debug(HeaderLine)
  CloseFile(0)
Else  
  Debug "Could not open " + FilePath
EndIf
2) If I create an excecutable and then try to open it in finder nothing happens.
You are using Line and HeaderLine.
Shouldn't that be one variable name instead of two ?

Did you set the executable format to MacOS ?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Re: Mac Newbie problems

Post by GedB »

wilbert wrote:You are using Line and HeaderLine.
Shouldn't that be one variable name instead of two ?

Did you set the executable format to MacOS ?
Thanks Wilbert,

The variable name mismatch is just where I've edited it down for brevity. The code inside the If block never executes.

The executable is MacOS - All CPU.
Fred
Administrator
Administrator
Posts: 18499
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Mac Newbie problems

Post by Fred »

You can try to add ".app" at the end of your executable filename to create a bundle.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Re: Mac Newbie problems

Post by GedB »

Thanks Fred, adding .app worked. The problem I have now is that the debugger isn't being included so I'm not seeing the debug messages.

I have debugger enabled with the standalone GUI debugger.
Fred
Administrator
Administrator
Posts: 18499
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Mac Newbie problems

Post by Fred »

Debugger is always switch off when creating an executable (even on Windows).
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Re: Mac Newbie problems

Post by GedB »

ReadFile is a silly mistake - I'm using >0 instead of <>0. :oops:

So rusty. Good to be back with PB. I'm so sick of Eclipse.
Fred
Administrator
Administrator
Posts: 18499
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Mac Newbie problems

Post by Fred »

You can also remove the "<> 0", it would be enough.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Re: Mac Newbie problems

Post by GedB »

Lovely, thanks.
Post Reply