diff options
author | Jeffrey Stedfast <jeff@xamarin.com> | 2014-10-29 20:53:47 +0300 |
---|---|---|
committer | Jeffrey Stedfast <jeff@xamarin.com> | 2014-10-29 20:54:31 +0300 |
commit | 6daf3ee62af42e4323e718b7e9ea59fd0c1898c6 (patch) | |
tree | 39733847da995576646088bd10a8ee3bb6010180 /main/build | |
parent | 94b9e55812b0fd12a3e587436beb06124c4378ae (diff) |
[MacOSX] Maintain backward compatibility with older XS/mtouch
Diffstat (limited to 'main/build')
-rw-r--r-- | main/build/MacOSX/monostub.m | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/main/build/MacOSX/monostub.m b/main/build/MacOSX/monostub.m index 2bef3f3022..78f0cb502c 100644 --- a/main/build/MacOSX/monostub.m +++ b/main/build/MacOSX/monostub.m @@ -262,24 +262,55 @@ update_environment (const char *contentsDir, const char *app) if ((value = str_append (contentsDir, "/Resources/lib/pkgconfig:/Library/Frameworks/Mono.framework/External/pkgconfig"))) { if (push_env ("PKG_CONFIG_PATH", value)) updated = YES; + free (value); } if ((value = str_append (contentsDir, "/Resources/lib"))) { if (push_env ("DYLD_FALLBACK_LIBRARY_PATH", value)) updated = YES; + free (value); } if ((value = str_append (contentsDir, "/Resources"))) { if (push_env ("MONO_GAC_PREFIX", value)) updated = YES; + free (value); } if ((value = str_append (contentsDir, "/MacOS"))) { - if (push_env ("PATH", value)) - updated = YES; + char *compat; + + // Note: older versions of Xamarin Studio incorrectly set the PATH to the Resources dir instead of the MacOS dir + // and older versions of mtouch relied on this broken behavior. + if ((compat = str_append (contentsDir, "/Resources"))) { + size_t compatlen = strlen (compat); + size_t valuelen = strlen (value); + char *combined; + + if ((combined = (char *) malloc (compatlen + valuelen + 2))) { + memcpy (combined, compat, compatlen); + combined[compatlen] = ':'; + strcpy (combined + compatlen + 1, value); + + if (push_env ("PATH", combined)) + updated = YES; + + free (combined); + } else { + // if we can't combine them, set the old (incorrect) compat value + if (push_env ("PATH", compat)) + updated = YES; + } + + free (compat); + } else { + if (push_env ("PATH", value)) + updated = YES; + } + free (value); } |