Page 1 of 1

"Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 6:21 pm
by booee
I notice that the "Answer File" no longer works in my Mac build, which I made for the Mac App Store.
I'm not sure if it's a permissions issue, because Mac maybe no longer accepts specialFolderPath("desktop") or
if I'm using an outdated version of LiveCode and a more recent version fixes the issue (currently using 9.6.4)

Here's the code I use below, which works in LiveCode, but does NOT do anything in my build.
==========
set the defaultFolder to specialFolderPath("desktop")
put the defaultFolder into tStartDirectory

answer file "Please select an image file." with tStartDirectory with \
type "All Images|jpg,jpeg,gif,png|JPEG,GIFf,PNGf" or \
type "JPEG Images|jgp,jpeg|JPEG" or \
type "GIF Images|gif|GIFf" or \
type "PNG Images|png|PNGf"
if it is not empty then

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 6:59 pm
by stam
Hi booee (fun fact - that autocorrects to booze ;) )
It is working... but you're may be falling foul of the syntax for multiple filetypes?

i'm not sure I understand what the 'OR' separated filetypes mean...
If you mean to include all filetypes in your call, then the first line is correct, ie:

Code: Select all

answer file "Please select an image file." with tStartDirectory with type "All Images|jpg,jpeg,gif,png|JPEG,GIFf,PNGf"
will enable selection of all specified filetypes in the answer dialog

So why include 'OR' statements for each individual filetype after this? Logically this seems strange, it's like saying "allow selection of all image file types, or allow selection of JPG, or allow selection of PNG etc.

If you're including these to allow selection of jpg, jpeg, gif, png, JPEG, GIFf, PNGf, then the first line suffices and the other lines are probably causing an error. What is it you're trying to do?

Stam

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 7:11 pm
by Klaus
This string will only be visible on Windows -> All Images
And the FILETYPEs are also deprecated on macOS since a long time, so we can leave that out, too:

Code: Select all

answer file "Please select an image file." with type "|jpg,jpeg,gif,png|"
Or do you mean you do not see that dialog at all in your runtime?
If yes, hm, usually macOS will ask if your app can access that folder (here Desktop folder)

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 7:45 pm
by booee
Interesting, I'll try some of those things to see if it helps...

However, yeah the problem is I don't even see the that dialog at all in your runtime of the application?
It works in LiveCode when I run from there, but not from the built app.
The macOS isn't even asking if your app can access that folder anymore. I remember it working last year, which is why I'm wondering if it's related to some OS updates.

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 7:59 pm
by booee
Looks like it just doesn't like the tStartDirectory to be specialFolderPath("desktop")

I changed it to: specialFolderPath("home") and it seems to be working better now.

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 8:07 pm
by Klaus
It is not neccessary to set "the defaultfolder" first, this will do:

Code: Select all

...
answer file "Please select an image file." with specialfolderpath("home") with type "|jpg,jpeg,gif,png|"
...

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 8:30 pm
by stam
I just ran this in the message box:

Code: Select all

answer file "Please select an image file." with specialfolderpath("desktop") with type "|jpg,jpeg,gif,png|"
and it worked just fine... (MacOS 12.1, LC 9.6.6 - and yes, with specialFolderPath("desktop")). If that is not working for you, there is something else going on, but it's not the answer file...

Re: "Answer File" open file dialog not working for Mac Build

Posted: Fri Feb 04, 2022 8:37 pm
by Klaus
booee wrote:
Here's the code I use below, which works in LiveCode, but does NOT do anything in my build.