FrozenGene commented on a change in pull request #8223: URL: https://github.com/apache/tvm/pull/8223#discussion_r651470581
########## File path: apps/cpp_rpc/rpc_env.cc ########## @@ -95,7 +96,16 @@ RPCEnv::RPCEnv(const std::string& wd) { auto cmdline = fopen("/proc/self/cmdline", "r"); fread(cwd, 1, sizeof(cwd), cmdline); fclose(cmdline); - base_ = "/data/data/" + std::string(cwd) + "/cache/rpc"; + std::string android_base_ = "/data/data/" + std::string(cwd) + "/cache"; + struct stat statbuf; + // Check if application data directory exist. If not exist usually mean tvm_rpc run from adb Review comment: Nitty comment. `If not exist, usually means we run tvm_rpc from adb shell terminal` ########## File path: apps/cpp_rpc/rpc_env.cc ########## @@ -95,7 +96,16 @@ RPCEnv::RPCEnv(const std::string& wd) { auto cmdline = fopen("/proc/self/cmdline", "r"); fread(cwd, 1, sizeof(cwd), cmdline); fclose(cmdline); - base_ = "/data/data/" + std::string(cwd) + "/cache/rpc"; + std::string android_base_ = "/data/data/" + std::string(cwd) + "/cache"; + struct stat statbuf; + // Check if application data directory exist. If not exist usually mean tvm_rpc run from adb + // shell terminal. + if (stat(android_base_.data(), &statbuf) == -1 || !S_ISDIR(statbuf.st_mode)) { + // Tmp directory always writable for 'shell' user. Review comment: `is always writable...` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org