Standalone Application Settings- Copy files

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Turtle
Posts: 16
Joined: Thu Nov 30, 2017 6:33 am

Standalone Application Settings- Copy files

Post by Turtle » Thu Nov 30, 2017 6:45 am

Hello,
I have a big problem with reading a text file, which i copied in standalone application settings. What i need to do is putting the file content into a field, but what i get is an empty result or "can't open that file". Here is what i have tried.

Code: Select all

on mouseUp
   put specialfolderpath("engine") into tPath
 
  set the itemdel to "/"
  delete item -1 of tPath

  put  tPath & "/page_1.txt" into file1
 
  set the text of field "taleText" to URL( "file:" &  file1)

end mouseUp
and

Code: Select all

on mouseUp
    put specialFolderPath("engine") into tMainPath
   set itemdel to "/"
 
   delete last item of tMainPath
   put tMainPath & "/page_1.txt"  into tURL
   open file tURL for read 
   read from file tURL until EOF
   put it into tText
   put textDecode(tText,"UTF-8") into field "taleText"
   close file  tURL
end mouseUp
I am using livecode 8.1.6 and testing on Android phones.
I have been searching answers in the forum but i could not find any that could help me :oops: Hope i will find my answer here.
Thanks

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Standalone Application Settings- Copy files

Post by Klaus » Thu Nov 30, 2017 11:07 am

Hi Turtle,

1. welcome to the forum!

2. You are making it much more complicated than it really is! :D
Everything you add via the "Copy files..." tab in the standalone builder settings can be found here:
specialfolderpath("resources") (which happens to be the same as -> specialfoderpath("engine") on mobile!)

No just need to modify the value of specialfolderpath:

Code: Select all

...
## specialfolderpath(..) comes WITHOUT the trailing slash
put specialfolderpath("resources") & "/page_1.txt" into file1
set the text of field "taleText" to URL("file:" &  file1)
...
That will do the trick!

Take a look at the "naked" specialfolderpath(..) codes and you will understand what went wrong:

Code: Select all

...
answer specialfolderpath("resources")
...
Best

Klaus

Turtle
Posts: 16
Joined: Thu Nov 30, 2017 6:33 am

Re: Standalone Application Settings- Copy files

Post by Turtle » Thu Nov 30, 2017 6:56 pm

Thank you :) And another thing that i think i did wrong is that when i copied the file it had different location than my livecode file ))) now everything works

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”