Page 1 of 1

How to get a list of files in a folder copied with Copy File

Posted: Mon Oct 20, 2014 9:34 am
by Mag
Hi all,

I'm trying to refer to a file which is inside a folder copied in a standalone with the appropriate Copy File dialog. There have to be something I'm doing wrong because I can't find a way to do it. Can't get the list of files.

In IDE all works fine, in Standalone I can't get it.


My first version:

Code: Select all

if the environment is "development" then
      put the effective filename of this stack into myPath
      set the itemDelimiter to slash
      put "Sounds/" into last item of myPath
      set the itemDelimiter to comma
      set the defaultFolder to myPath
   else -- standalone
      set the defaultFolder to "Sounds" -- this gives the standard OS X sounds folder path
   end if

   put the files into soundListFiles
   answer soundListFiles

My second version:

Code: Select all

if the environment is "development" then
      put the effective filename of this stack into myPath
      set the itemDelimiter to slash
      put "Sounds/" into last item of myPath
      set the itemDelimiter to comma
      set the defaultFolder to myPath
   else -- standalone
     set the itemDelimiter to slash
     get the effective filename of this stack
     put item 1 to -2 of it & "/Sounds" into a
     set the defaultFolder to  a -- this gives "/Sounds"
   end if

   put the files into soundListFiles
   answer soundListFiles
My third version:

Code: Select all

if the environment is "development" then
      put the effective filename of this stack into myPath
      set the itemDelimiter to slash
      put "Sounds/" into last item of myPath
      set the itemDelimiter to comma
      set the defaultFolder to myPath
   else -- standalone
      put specialFolderPath("engine") & slash & "Sounds" into soundsFolder -- gives an "invented" folder: Users/user/Library/Application Support/Sounds
      set the defaultFolder to soundsFolder
   end if

   put the files into soundListFiles
   answer soundListFiles

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 1:07 pm
by Simon
Which version of liveCode are you using?

OK... there is a bug with liveCode 6.6.x and Copy Files, I did stumble on a silly work around. Just include 1 file (not folder) in the Copy Files.

Simon

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 1:19 pm
by Mag
Hi Simon,

Thanks so much for your Info!

LiveCode 6.6.3 Commercial
OS X Yosemite 10.10

PS
What is interesting, is that what I was doing was a workaround, to another thing that did not work. :D :D :D

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 1:35 pm
by Simon
Hi Mag,
I've been watching your Yosemite troubles but really have no experience to help.
So, anything I say has no basis in solving (possible) Yosemite problems.

Simon

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 1:38 pm
by Mag
OK, tested, unfortunatly this workaround doesn't work here :-(

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 1:40 pm
by Mag
Simon,

No problem, it's just talking that you will find solutions, so thank you for each attempt.

It's for days that I rewrite parts of the app because of problems to signing, compatibility, new bugs of LC etc. I'm working on this project for more than 6 months and for sure I do not stop now. I must say that the most important part of LiveCode is this community, otherwise I would have left LC development already for quite a while. I apologize for sincerity.

Re: How to get a list of files in a folder copied with Copy

Posted: Mon Oct 20, 2014 3:18 pm
by bn
Hi Mag,

I tested your scripts with LC 6.6.4 and Mavericks. I made up 2 folder, sounds and images and in Standalone settings did as you did as per your image, just including the folders.

Script 1 and 3 work in the standalone and IDE, they both list the files in the included folders.

I don't know if there is something in Yosemite that keeps this from working.

Kind regards
Bernd

Edit: corrected LC version from 6.4 to 6.6.4