Get files from file system on mobile

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
charms
Posts: 122
Joined: Mon Feb 10, 2014 6:21 pm
Location: Singapore
Contact:

Get files from file system on mobile

Post by charms » Thu Apr 10, 2014 11:03 pm

I'm currently developing an application that will create a playlist of video files. The files have to be copied on to the tablet first from the users computer. From there they have to be copied in to the specialFolderPath. On Mac OS X this is easy done by using "answer file", navigating to the file, selecting it and copy it. However on Mobile this is not supported. After some reading I have discovered that there is a way to set the defaultFolder and then reading this folder.

Code: Select all

on openCard
   set the defaultFolder to "/"
   put the files into field "files"
end openCard
When I do this on Mac OS X I have the issue that it doesn't display all the files. It displays only some:

Listed files in Stack:

Code: Select all

.file
.hotfiles.btree
dev
etc
home
mach_kernel
net
tmp
User Information
var
ls -l in Terminal Window:

Code: Select all

ls -l /
drwxrwxr-x+ 74 root  admin     2516 Apr  9 23:19 Applications
drwxr-xr-x+ 64 root  wheel     2176 Mar  2 12:27 Library
drwxr-xr-x@  2 root  wheel       68 Aug 25  2013 Network
drwxr-xr-x+  4 root  wheel      136 Nov 10 19:54 System
lrwxr-xr-x   1 root  wheel       49 Feb 21 18:55 User Information -> /Library/Documentation/User Information.localized
drwxr-xr-x   6 root  admin      204 Feb 21 18:55 Users
drwxrwxrwt@  5 root  admin      170 Apr 10 21:07 Volumes
drwxr-xr-x@ 39 root  wheel     1326 Mar  1 19:06 bin
drwxrwxr-t@  2 root  admin       68 Aug 25  2013 cores
dr-xr-xr-x   3 root  wheel     4716 Mar 30 01:27 dev
lrwxr-xr-x@  1 root  wheel       11 Nov 10 19:48 etc -> private/etc
dr-xr-xr-x   2 root  wheel        1 Mar 30 01:27 home
-rwxr-xr-x@  1 root  wheel  8393408 Feb 18 00:23 mach_kernel
dr-xr-xr-x   2 root  wheel        1 Mar 30 01:27 net
drwxr-xr-x   3 root  wheel      102 Sep 27  2012 opt
drwxr-xr-x@  6 root  wheel      204 Nov 10 19:56 private
drwxr-xr-x@ 62 root  wheel     2108 Mar  1 19:06 sbin
lrwxr-xr-x@  1 root  wheel       11 Nov 10 19:48 tmp -> private/tmp
drwxr-xr-x@ 12 root  wheel      408 Feb 21 23:39 usr
lrwxr-xr-x@  1 root  wheel       11 Nov 10 19:48 var -> private/var
And on Mobile it's totally different. Regardless if I specify "/" or "/storage/sdcard0" I get following output:

Code: Select all

ueventd.rc
ueventd.goldfish.rc
init.usb.rc
init.rc
init.goldfish.rc
init
default.prop
But I should see something like this:

Code: Select all

    swlite_stmt_journals
    config
    cache
    sdcard
    d
    etc
    system
    sys
    sbin
    proc
    init.sholes.rc
    init.rc
    init.goldfish.rc
    init
    default.prop
    data
    root
    dev
I don't really understand in what path I'm actually in. After some googling for some of the files it seems like if I am in "/" but also don't see many of the directories. So it seems to be a permission issue.

* How am I able to see all the files and navigate through the folders to find my files such as in a file explorer?
* Is there a more efficient way how to transfer video files to the tablet and then loading them in to the applications specialFolderPath? I need to do this on Android and IOS.

Thanks,
Chris

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Get files from file system on mobile

Post by bangkok » Fri Apr 11, 2014 9:22 am

Nothing wrong here...

Code: Select all

put the files
... will display files (and only files)

Code: Select all

put the folders
... will display directories

:D

charms
Posts: 122
Joined: Mon Feb 10, 2014 6:21 pm
Location: Singapore
Contact:

Re: Get files from file system on mobile

Post by charms » Fri Apr 11, 2014 4:33 pm

Khob khun krab, bangkok 8) If you are living there I'm jealous. Was working in Bangkok one year before and waiting for the next opportunity to go there again.

put the folders was the answer :oops:

Post Reply

Return to “idea2app and Coding School”