mirror of
				https://github.com/lacerta-doc/Lacerta.git
				synced 2025-09-09 12:09:25 +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 backDir(); //cd ..
 | 
			
		||||
    void backRootDir(); //cd /
 | 
			
		||||
    List<String> getDirList(); //ls
 | 
			
		||||
    List<String> getFileList(); //ls
 | 
			
		||||
    List<Path> getList();
 | 
			
		||||
    void createDir();
 | 
			
		||||
    void removeDir();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,11 @@ package one.nem.lacerta.source.file.impl;
 | 
			
		|||
 | 
			
		||||
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.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -54,14 +58,18 @@ public class FileManagerImpl implements FileManager {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> getDirList() {
 | 
			
		||||
        // currentDirにあるディレクトリの一覧を返す
 | 
			
		||||
        return Arrays.asList(currentDir.toFile().list());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> getFileList() {
 | 
			
		||||
        return null;
 | 
			
		||||
    public List<Path> getList() {
 | 
			
		||||
        List<Path> list = new ArrayList<>();
 | 
			
		||||
        try (DirectoryStream<Path> stream = Files.newDirectoryStream(currentDir)) {
 | 
			
		||||
            for (Path entry : stream) {
 | 
			
		||||
                if (Files.isDirectory(entry)) {
 | 
			
		||||
                    list.add(entry);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user