Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions pythonforandroid/bootstraps/sdl2/build/jni/src/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ int main(int argc, char *argv[]) {
setenv("ANDROID_APP_PATH", env_argument, 1);
env_entrypoint = getenv("ANDROID_ENTRYPOINT");
env_logname = getenv("PYTHON_NAME");

if (!getenv("ANDROID_UNPACK")) {
/* ANDROID_UNPACK currently isn't set in services */
setenv("ANDROID_UNPACK", env_argument, 1);
}

if (env_logname == NULL) {
env_logname = "python";
Expand All @@ -104,12 +109,15 @@ int main(int argc, char *argv[]) {

LOGP("Preparing to initialize python");

if (dir_exists("crystax_python/")) {
char crystax_python_dir[256];
snprintf(crystax_python_dir, 256,
"%s/crystax_python", getenv("ANDROID_UNPACK"));
if (dir_exists(crystax_python_dir)) {
LOGP("crystax_python exists");
char paths[256];
snprintf(paths, 256,
"%s/crystax_python/stdlib.zip:%s/crystax_python/modules",
env_argument, env_argument);
"%s/stdlib.zip:%s/modules",
crystax_python_dir, crystax_python_dir);
/* snprintf(paths, 256, "%s/stdlib.zip:%s/modules", env_argument,
* env_argument); */
LOGP("calculated paths to be...");
Expand Down Expand Up @@ -166,11 +174,11 @@ int main(int argc, char *argv[]) {
" argument ]\n");
}

if (dir_exists("crystax_python")) {
if (dir_exists(crystax_python_dir)) {
char add_site_packages_dir[256];
snprintf(add_site_packages_dir, 256,
"sys.path.append('%s/crystax_python/site-packages')",
env_argument);
"sys.path.append('%s/site-packages')",
crystax_python_dir);

PyRun_SimpleString("import sys\n"
"sys.argv = ['notaninterpreterreally']\n"
Expand Down