1 // Copyright 2013 The Flutter 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 package io.flutter.util; 6 7 import android.content.Context; 8 import android.os.Build; 9 10 public final class PathUtils { getFilesDir(Context applicationContext)11 public static String getFilesDir(Context applicationContext) { 12 return applicationContext.getFilesDir().getPath(); 13 } 14 getDataDirectory(Context applicationContext)15 public static String getDataDirectory(Context applicationContext) { 16 return applicationContext.getDir("flutter", Context.MODE_PRIVATE).getPath(); 17 } 18 getCacheDirectory(Context applicationContext)19 public static String getCacheDirectory(Context applicationContext) { 20 if (Build.VERSION.SDK_INT >= 21) { 21 return applicationContext.getCodeCacheDir().getPath(); 22 } else { 23 return applicationContext.getCacheDir().getPath(); 24 } 25 } 26 } 27