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