Skip to content

Commit

Permalink
Tweaks to get the tests running inside an Android apk
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim committed Aug 5, 2014
1 parent 60cfc11 commit a5f2d0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions std/process.d
Expand Up @@ -2117,8 +2117,9 @@ $(D "/bin/sh").
*/
@property string userShell() @safe //TODO: nothrow
{
version (Windows) return environment.get("COMSPEC", "cmd.exe");
else version (Posix) return environment.get("SHELL", "/bin/sh");
version (Windows) return environment.get("COMSPEC", "cmd.exe");
else version (Android) return environment.get("SHELL", "/system/bin/sh");
else version (Posix) return environment.get("SHELL", "/bin/sh");
}


Expand Down
11 changes: 11 additions & 0 deletions std/stdio.d
Expand Up @@ -1957,6 +1957,17 @@ $(XREF file,readText)
auto file = File(deleteme, "w+");
scope(success) std.file.remove(deleteme);
}
else version(Android)
{
static import std.file;

/* the C function tmpfile doesn't work when called from a shared
library apk:
https://code.google.com/p/android/issues/detail?id=66815 */
auto deleteme = testFilename();
auto file = File(deleteme, "w+");
scope(success) std.file.remove(deleteme);
}
else
auto file = File.tmpfile();
file.write("1\n2\n3\n");
Expand Down

0 comments on commit a5f2d0f

Please sign in to comment.