changes to support eclipse compat

support of Android assets as /assets files.
This commit is contained in:
Vítor Santos Costa
2014-06-04 22:08:37 +01:00
parent 3087d51b18
commit 71b40e0438
28 changed files with 1273 additions and 569 deletions

View File

@@ -3247,7 +3247,17 @@ openStream(term_t file, term_t mode, term_t options)
} else
#endif /*HAVE_POPEN*/
if ( PL_get_file_name(file, &path, 0) )
{ if ( !(s = Sopen_file(path, how)) )
{
#if __ANDROID__
if (strstr(path,"/assets/")) {
if (!(s=Sopen_asset(path+8, "r")))
{ PL_error(NULL, 0, OsError(), ERR_FILE_OPERATION,
ATOM_open, ATOM_source_sink, file);
return NULL;
}
} else
#endif
if ( !(s = Sopen_file(path, how)) )
{ PL_error(NULL, 0, OsError(), ERR_FILE_OPERATION,
ATOM_open, ATOM_source_sink, file);
return NULL;