From c0e96f0ec192eff4b36574f703e62030da028bbf Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 2 May 2011 13:29:14 +0200 Subject: Use user-specific directory for temporary files. Instead of use /tmp/android/, use /tmp/android-$USER/ so that several users can run the emulator easily on the same system. Change-Id: Ifda1b773cc87a9e0d4ff7e256b74a3f93377d73a --- android/utils/bufprint.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/utils/bufprint.c b/android/utils/bufprint.c index e3aa63c..4626a0f 100644 --- a/android/utils/bufprint.c +++ b/android/utils/bufprint.c @@ -147,7 +147,7 @@ bufprint_app_dir(char* buff, char* end) len = sizeof(appDir)-1; appDir[len] = 0; } - + sep = strrchr(appDir, '\\'); if (sep) *sep = 0; @@ -215,9 +215,15 @@ bufprint_temp_dir(char* buff, char* end) return bufprint(buff, end, "%s", path); #else + char path[MAX_PATH]; const char* tmppath = getenv("ANDROID_TMP"); if (!tmppath) { - tmppath = "/tmp/android"; + const char* user = getenv("USER"); + if (user == NULL || user[0] == '\0') + user = "unknown"; + + snprintf(path, sizeof path, "/tmp/android-%s", user); + tmppath = path; } mkdir(tmppath, 0744); return bufprint(buff, end, "%s", tmppath ); -- cgit v1.1