鸿蒙手机获取SD卡路径

 LogUtil.d(TAG, "getCacheDir=" + context.getCacheDir().getPath());
        LogUtil.d(TAG, "getCodeCacheDir=" + context.getCodeCacheDir().getPath());
        LogUtil.d(TAG, "getDatabaseDir=" + context.getDatabaseDir().getPath());
        LogUtil.d(TAG, "getDataDir=" + context.getDataDir().getPath());
//        LogUtil.d(TAG, "getDir=" + context.getDir().getPath());
        LogUtil.d(TAG, "getExternalCacheDir=" + context.getExternalCacheDir().getPath());
        LogUtil.d(TAG, "getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)=" + context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getPath());
        LogUtil.d(TAG, "getDistributedDir=" + getDistributedDir().getPath());
        LogUtil.d(TAG, "getFilesDir=" + getFilesDir().getPath());
        LogUtil.d(TAG, "getNoBackupFilesDir=" + getNoBackupFilesDir().getPath());
        LogUtil.d(TAG, "getPreferencesDir=" + getPreferencesDir().getPath());

输出

05-20 16:17:29.676 27894-27894/? I System.out: ThreadAbilitySlice getCacheDir=/data/user/0/com.jzqf.harmonydemo/cache
05-20 16:17:29.676 27894-27894/? I System.out: ThreadAbilitySlice getCodeCacheDir=/data/user/0/com.jzqf.harmonydemo/code_cache
05-20 16:17:29.677 27894-27894/? I System.out: ThreadAbilitySlice getDatabaseDir=/data/data/com.jzqf.harmonydemo/ThreadAbility/databases
05-20 16:17:29.677 27894-27894/? I System.out: ThreadAbilitySlice getDataDir=/data/user/0/com.jzqf.harmonydemo
05-20 16:17:29.683 27894-27894/? I System.out: ThreadAbilitySlice getExternalCacheDir=/storage/emulated/0/Android/data/com.jzqf.harmonydemo/cache
05-20 16:17:29.685 27894-27894/? I System.out: ThreadAbilitySlice getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)=/storage/emulated/0/Android/data/com.jzqf.harmonydemo/files/Download
05-20 16:17:29.690 27894-27894/? I System.out: ThreadAbilitySlice getDistributedDir=/mnt/mdfs/699956351188076798/merge_view/data/com.jzqf.harmonydemo/ThreadAbility
05-20 16:17:29.690 27894-27894/? I System.out: ThreadAbilitySlice getFilesDir=/data/user/0/com.jzqf.harmonydemo/files
05-20 16:17:29.690 27894-27894/? I System.out: ThreadAbilitySlice getNoBackupFilesDir=/data/user/0/com.jzqf.harmonydemo/no_backup
05-20 16:17:29.690 27894-27894/? I System.out: ThreadAbilitySlice getPreferencesDir=/data/data/com.jzqf.harmonydemo/ThreadAbility/preferences

 

你可能感兴趣的:(鸿蒙)