1

I put some items in my asset folder. Here as below :

|Asset

|_ONE

|_CAT.JPEG

I want to determine is "ONE" is a Directory, and "CAT.JPEG" is a file.

I Tried with something like below:

        AssetManager _assetManager = Assets;
        string[] _files = null;
        try
        {
            _files = _assetManager.List("");
        }
        catch(IOException e)
        {
            Log.Error("Get All Child", "Failed to get asset file list.", e);
        }
        string _rootAssetFolder = "file:///android_asset/";
        foreach(string _filename in _files)
        {
            string _sourcePathFull = _rootAssetFolder+ _filename;
            Java.IO.File _target = new Java.IO.File(_sourcePathFull);
            if(_target.IsDirectory)
            {
                Console.WriteLine("IS DIRECTORY");
            }
            else if(_target.IsFile)
            {
                Console.WriteLine("IS FILE");
            }
            else
            {
               Console.WriteLine("UNRECOGNIZE");
            }
        }

But I always get UNRECOGNIZE

mas_bejo
  • 597
  • 2
  • 6
  • 22

1 Answers1

0

This can be helpful https://www.tutorialspoint.com/java/io/file_isfile.htm By the way what you have set in _sourcePathFull?

umesh shukla
  • 139
  • 3
  • 13