Copy file

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Contact:

Copy file

Post by Neurox66 » Tue Aug 28, 2012 8:18 am

Hi,
I'm crazy out with this code :-(
My code is attempt to copy the text file from "engine folder" to "Documents folder" but
in my Iphone 4 the message is ever "File not found".
Any hints ?

Code: Select all

on preOpenStack
      if the environment is "mobile" then
         put "file:" & specialFolderPath("engine") & "/dati.txt"  into vEngine
         put "file:" & specialFolderPath("documents") & "/dati.txt"  into vDocuments
         if there is a file url vDocuments then
            answer "The file is present, step 1"
            put url vDocuments into fDocuments
            if fDestinazione is empty then
               answer "The file is present but is empty, step 1.1"
               put url vEngine into fDocuments
               put  fDocuments into url vDocuments 
               close file vDocuments
            else
               answer "The file is present and is not empty step 1.2"
            end if
         else
            answer "The file not found, step 1.3"
            put url vEngine into fDestinazione
            put  fDocuments into url vDocuments 
            close file vDocuments
         end if
         
         //New check
         wait 25 milliseconds with messages
         if not (there is a file url vDocuments) then answer "The file not found Step 2"
            
      try
      catch pErr
         answer pErr
      end try
   end if
   
end preOpenStack
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Copy file

Post by Dixie » Tue Aug 28, 2012 8:31 am

Code: Select all

on preOpenStack
   put specialFolderPath("documents") & "/dati.txt" into documentFilePath
   if there is not a file documentFilePath then
      put URL("file:" & specialFolderPath("engine") & "/dati.txt") into URL("file:" & specialFolderPath("documents") & "/dati.txt")
   end if
end preOpenStack
be well,

Dixie

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Contact:

Re: Copy file

Post by Neurox66 » Tue Aug 28, 2012 8:50 am

Hi Dixie,
your code go very well :D
Thank you!

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy file

Post by Klaus » Tue Aug 28, 2012 11:15 am

Hi Neurox66,

1. welcome to the forum :D
2. Check these stacks to get the basics of Livecode:
http://www.runrev.com/developers/lesson ... nferences/ 8)


Best

Klaus

Post Reply