mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
getList修正
This commit is contained in:
parent
fd74f5eab0
commit
d0543d89b9
|
@ -11,8 +11,7 @@ public interface FileManager {
|
||||||
void changeDir(String dirName); //cd
|
void changeDir(String dirName); //cd
|
||||||
void backDir(); //cd ..
|
void backDir(); //cd ..
|
||||||
void backRootDir(); //cd /
|
void backRootDir(); //cd /
|
||||||
List<String> getDirList(); //ls
|
List<Path> getList();
|
||||||
List<String> getFileList(); //ls
|
|
||||||
void createDir();
|
void createDir();
|
||||||
void removeDir();
|
void removeDir();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,11 @@ package one.nem.lacerta.source.file.impl;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.DirectoryStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -54,14 +58,18 @@ public class FileManagerImpl implements FileManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDirList() {
|
public List<Path> getList() {
|
||||||
// currentDirにあるディレクトリの一覧を返す
|
List<Path> list = new ArrayList<>();
|
||||||
return Arrays.asList(currentDir.toFile().list());
|
try (DirectoryStream<Path> stream = Files.newDirectoryStream(currentDir)) {
|
||||||
}
|
for (Path entry : stream) {
|
||||||
|
if (Files.isDirectory(entry)) {
|
||||||
@Override
|
list.add(entry);
|
||||||
public List<String> getFileList() {
|
}
|
||||||
return null;
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user