1. Download the free trial version

What's under DirAssets?

Discussion in 'Questions' started by boten, Nov 8, 2011.

  1. boten

    boten Active Member Licensed User

    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)
  2. Erel

    Erel Administrator Staff Member Licensed User

    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.
  3. boten

    boten Active Member Licensed User

    well, both stmts returned false :confused:

    Code:
    Log(File.Exists(File.DirAssets,"/sdir/b.txt"))
    Log(File.Exists(File.DirAssets,"sdir/b.txt"))
  4. Erel

    Erel Administrator Staff Member Licensed User

    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.

Share This Page

Loading...