mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-09 19:50:27 +08:00
Add RemoteFile.listFilesCollection()
Co-authored-by: Karlatemp <karlatemp@vip.qq.com>
This commit is contained in:
parent
5f02c35e66
commit
b5d8306902
@ -5914,6 +5914,8 @@ public abstract interface class net/mamoe/mirai/utils/RemoteFile {
|
||||
public abstract fun length (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFiles ()Lkotlinx/coroutines/flow/Flow;
|
||||
public abstract fun listFiles (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFilesCollection ()Ljava/util/List;
|
||||
public fun listFilesCollection (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFilesIterator (Z)Ljava/util/Iterator;
|
||||
public abstract fun listFilesIterator (ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun mkdir ()Z
|
||||
|
@ -5943,6 +5943,8 @@ public abstract interface class net/mamoe/mirai/utils/RemoteFile {
|
||||
public abstract fun length (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFiles ()Lkotlinx/coroutines/flow/Flow;
|
||||
public abstract fun listFiles (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFilesCollection ()Ljava/util/List;
|
||||
public fun listFilesCollection (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun listFilesIterator (Z)Ljava/util/Iterator;
|
||||
public abstract fun listFilesIterator (ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public fun mkdir ()Z
|
||||
|
@ -15,6 +15,7 @@ package net.mamoe.mirai.utils
|
||||
import kotlinx.coroutines.channels.SendChannel
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import net.mamoe.kjbb.JvmBlockingBridge
|
||||
import net.mamoe.mirai.contact.Contact
|
||||
import net.mamoe.mirai.contact.FileSupported
|
||||
@ -240,6 +241,11 @@ public interface RemoteFile {
|
||||
@JavaFriendlyAPI
|
||||
public suspend fun listFilesIterator(lazy: Boolean): Iterator<RemoteFile>
|
||||
|
||||
/**
|
||||
* 获取该目录下所有文件, 返回的 [RemoteFile] 都拥有 [RemoteFile.id] 用于区分重名文件或目录. 当 [RemoteFile] 表示一个文件时返回 [emptyList].
|
||||
*/
|
||||
public suspend fun listFilesCollection(): List<RemoteFile> = listFiles().toList()
|
||||
|
||||
/**
|
||||
* 得到相应文件消息, 可以发送. 当 [RemoteFile] 表示一个目录或文件不存在时返回 `null`.
|
||||
*/
|
||||
@ -399,4 +405,4 @@ public interface RemoteFile {
|
||||
return this.filesRoot.resolve(path).uploadAndSend(resource) as MessageReceipt<C>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user