blob: dc45c28da622dfbab06c0f3b49b35fff02dd6f71 [file] [log] [blame]
michaelbai@google.com686190b2011-08-03 01:11:16 +09001// Copyright (c) 2011 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
5#include "base/android/path_utils.h"
6
michaelbai@google.com686190b2011-08-03 01:11:16 +09007#include "base/android/jni_android.h"
8#include "base/android/jni_string.h"
joth@chromium.orged27f3a2011-09-09 19:17:35 +09009#include "base/android/scoped_java_ref.h"
michaelbai@google.com686190b2011-08-03 01:11:16 +090010
11#include "jni/path_utils_jni.h"
12
13namespace base {
14namespace android {
15
16std::string GetDataDirectory() {
17 JNIEnv* env = AttachCurrentThread();
joth@chromium.orged27f3a2011-09-09 19:17:35 +090018 ScopedJavaLocalRef<jstring> path(env, Java_PathUtils_getDataDirectory(
steveblock@google.comb6cdd982011-08-11 20:23:52 +090019 env, base::android::GetApplicationContext()));
20 return base::android::ConvertJavaStringToUTF8(env, path.obj());
michaelbai@google.com686190b2011-08-03 01:11:16 +090021}
22
23std::string GetCacheDirectory() {
24 JNIEnv* env = AttachCurrentThread();
joth@chromium.orged27f3a2011-09-09 19:17:35 +090025 ScopedJavaLocalRef<jstring> path(env, Java_PathUtils_getCacheDirectory(
steveblock@google.comb6cdd982011-08-11 20:23:52 +090026 env, base::android::GetApplicationContext()));
27 return base::android::ConvertJavaStringToUTF8(env, path.obj());
michaelbai@google.com686190b2011-08-03 01:11:16 +090028}
29
30bool RegisterPathUtils(JNIEnv* env) {
31 return RegisterNativesImpl(env);
32}
33
34} // namespace android
35} // namespace base