HI, Can someone help me how to get file paths from Android device (Oculus Go in my case). The following code does find all files, but the line lista.Add(f.ToString()); only adds the filename to list when deployed to Oculus Go. In editor it works just fine and shows the full path to the file in question. Code (csharp): private List<string> lista = new List<string>(); private List<string> nimilista = new List<string>(); dir = new DirectoryInfo("/mnt/sdcard/Videos/"); FileInfo[] info = dir.GetFiles("*.*", SearchOption.AllDirectories); foreach (FileInfo f in info) { if(Path.GetExtension(f.ToString()) == ".mp4") { //This is a list that I am having problems with lista.Add(f.ToString()); //This is a list nimilista.Add(Path.GetFileName(f.ToString())); } }
https://docs.microsoft.com/en-us/dotnet/api/system.io.fileinfo?view=netframework-4.7.2 According to the documentation tostring should return the path. If it isn't the actual full path, try f.FullPath or f.FullName
Thank you nilsdr. f.FullName worked like a charm. I have no idea why simply f.ToString didn't work. Spent the whole of yesterday trying to figure this out by my self. Sometimes it might be a time saver to ask someone who actually knows what they are doing.