2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2017-03-22 15:42:51 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
package io.flutter.util;
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
2019-04-10 15:32:31 -07:00
|
|
|
import android.os.Build;
|
2017-03-22 15:42:51 -07:00
|
|
|
|
|
|
|
|
public final class PathUtils {
|
2018-08-07 14:37:19 -07:00
|
|
|
public static String getFilesDir(Context applicationContext) {
|
|
|
|
|
return applicationContext.getFilesDir().getPath();
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-22 15:42:51 -07:00
|
|
|
public static String getDataDirectory(Context applicationContext) {
|
2017-03-24 16:25:33 -07:00
|
|
|
return applicationContext.getDir("flutter", Context.MODE_PRIVATE).getPath();
|
2017-03-22 15:42:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getCacheDirectory(Context applicationContext) {
|
2019-04-10 15:32:31 -07:00
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
|
return applicationContext.getCodeCacheDir().getPath();
|
|
|
|
|
} else {
|
|
|
|
|
return applicationContext.getCacheDir().getPath();
|
|
|
|
|
}
|
2017-03-22 15:42:51 -07:00
|
|
|
}
|
|
|
|
|
}
|