file_util_android.cc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/files/file_util.h"
  5. #include "base/android/jni_android.h"
  6. #include "base/android/jni_string.h"
  7. #include "base/base_jni_headers/FileUtils_jni.h"
  8. #include "base/files/file_path.h"
  9. #include "base/path_service.h"
  10. using base::android::JavaParamRef;
  11. using base::android::JavaRef;
  12. using base::android::ScopedJavaLocalRef;
  13. namespace base {
  14. namespace android {
  15. static ScopedJavaLocalRef<jstring> JNI_FileUtils_GetAbsoluteFilePath(
  16. JNIEnv* env,
  17. const JavaParamRef<jstring>& j_file_path) {
  18. base::FilePath file_path(
  19. base::android::ConvertJavaStringToUTF8(env, j_file_path));
  20. base::FilePath absolute_file_path = MakeAbsoluteFilePath(file_path);
  21. return base::android::ConvertUTF8ToJavaString(env,
  22. absolute_file_path.value());
  23. }
  24. } // namespace android
  25. bool GetShmemTempDir(bool executable, base::FilePath* path) {
  26. return PathService::Get(base::DIR_CACHE, path);
  27. }
  28. } // namespace base