Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Basic4android Updates and Questions
Documentation Wiki Register Members List Windows Mobile Search Today's Posts Mark Forums Read

Basic4android Updates and Questions Updates and questions regarding Basic4android.

What's under DirAssets?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-08-2011, 10:51 AM
boten's Avatar
Knows the basics
 
Join Date: Jul 2011
Posts: 220
Default What's under DirAssets?

I created a sub-folder ("sdir") under the Files folder of my project.

In the Files folder there is one file "a.txt"
In the subfolder "sdir" (Files/sdir) there is one file "b.txt"

the stmt:
Code:
Log(File.ListFiles(File.DirAssets ))
lists the file and sub-folders in Files (including "a.txt" and "sdir")

but the stmt:
Code:
Log(File.ListFiles(File.DirAssets & "/sdir" ))
produce an error

The log is:
Code:
** Activity (main) Create, isFirst = true **
(ArrayList) [<b>a.txt</b>, images, <b>sdir</b>, sounds, webkit]

main_activity_create (java line: 
210)
java.io.IOException: AssetsDir/sdir 
is not a folder.
Any way to "reach" files in a sub-folder of Files?

(I know I can add "b.txt" via the files tab of the project, but that really copies the file to the Files folder - not what I want)
Reply With Quote
  #2 (permalink)  
Old 11-08-2011, 11:12 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 25,889
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You can access a file in a subfolder of the assets folder. However you cannot list this subfolder.
If you want to access a file in a subfolder of assets folder you should add the subfolder as a prefix to the file name. The folder should stay File.DirAssets.
Reply With Quote
  #3 (permalink)  
Old 11-08-2011, 12:05 PM
boten's Avatar
Knows the basics
 
Join Date: Jul 2011
Posts: 220
Default

well, both stmts returned false

Code:
Log(File.Exists(File.DirAssets,"/sdir/b.txt"))
Log(File.Exists(File.DirAssets,"sdir/b.txt"))
Reply With Quote
  #4 (permalink)  
Old 11-09-2011, 05:55 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 25,889
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

File.Exists is also problematic with subfolders of the assets folder. However there is no reason to use it as you do know which files are located there.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL DB Copy From DirAssets problem petri2000 Basic4android Updates and Questions 3 07-14-2011 11:23 AM
Random Access on files in DirAssets Steven Sparrow Basic4android Updates and Questions 2 05-10-2011 06:41 AM
Wish: Directories in DirAssets kickaha Bugs & wishlist 0 02-23-2011 11:27 PM


All times are GMT. The time now is 01:58 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0