Merge branch 'ahf/android-gp-fixes-bulk' into 'main'

Bulk Android path changes

Closes #40487

See merge request tpo/core/tor!762
This commit is contained in:
David Goulet 2023-09-18 13:12:36 +00:00
commit 7278c1554d
2 changed files with 19 additions and 0 deletions

3
changes/ticket40487 Normal file
View File

@ -0,0 +1,3 @@
o Minor features (portability, android):
- Use /data/local/tmp for data storage on Android by default. Closes ticket
40487. Patch from Hans-Christoph Steiner.

View File

@ -483,6 +483,13 @@ static const config_var_t option_vars_[] = {
#ifdef _WIN32
V(GeoIPFile, FILENAME, "<default>"),
V(GeoIPv6File, FILENAME, "<default>"),
#elif defined(__ANDROID__)
/* Android apps use paths that are configured at runtime.
* /data/local/tmp is guaranteed to exist, but will only be
* usable by the 'shell' and 'root' users, so this fallback is
* for debugging only. */
V(GeoIPFile, FILENAME, "/data/local/tmp/geoip"),
V(GeoIPv6File, FILENAME, "/data/local/tmp/geoip6"),
#else
V(GeoIPFile, FILENAME,
SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
@ -6900,6 +6907,15 @@ get_data_directory(const char *val)
} else {
return tor_strdup(get_windows_conf_root());
}
#elif defined(__ANDROID__)
/* Android apps can only use paths that are configured at runtime.
* /data/local/tmp is guaranteed to exist, but is only usable by the
* 'shell' and 'root' users, so this fallback is for debugging only. */
if (val) {
return tor_strdup(val);
} else {
return tor_strdup("/data/local/tmp");
}
#else /* !defined(_WIN32) */
const char *d = val;
if (!d)