Page 1 of 1
Mac Newbie problems
Posted: Wed Jul 17, 2013 12:02 pm
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.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 12:24 pm
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 ?
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 2:38 pm
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.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 2:42 pm
by Fred
You can try to add ".app" at the end of your executable filename to create a bundle.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 2:42 pm
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.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 2:45 pm
by Fred
Debugger is always switch off when creating an executable (even on Windows).
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 2:54 pm
by GedB
ReadFile is a silly mistake - I'm using >0 instead of <>0.
So rusty. Good to be back with PB. I'm so sick of Eclipse.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 3:20 pm
by Fred
You can also remove the "<> 0", it would be enough.
Re: Mac Newbie problems
Posted: Wed Jul 17, 2013 4:40 pm
by GedB
Lovely, thanks.