FileType fails for files in data folder (android)
Monkey Forums/Monkey Bug Reports/FileType fails for files in data folder (android)
| ||
FileType does not work with a file stored in your data folder. It always returns 0. I have tested loading the contents of a text file into databuffer and it works, but FileType on the same path does not. |
| ||
Seems as though FileSize also doesn't work |
| ||
Data files on android are not actually files - they're assets, embedded in a zip. To be able to treat them as proper files, you'll need to copy them to monkey://internal/ first or something. |
| ||
Thought this might be the case, same in XNA. Maybe monkey could create special compiled functions AssetFileSize and AssetFileType which contain select statement for all file paths in data folder? Then trans could read the file sizes at compile time and hard code them? It's not really that "clean" but beats having to open the file to determine the details... |
| ||
Or read the file into a DataBuffer before checking the type or size? This way FileType and FileSize can be used. The only adjustment would be checking the target, and the loading into DataBuffer :) |
| ||
Yeah I have this now but it seemed like there could be a smarter approach. I think the html5 target already adds meta data for images, so could be useful to flesh it out a bit. |