mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Map size or length property depending on mimetype
This commit is contained in:
parent
e9d4fa99b3
commit
86c889b8f5
@ -76,12 +76,24 @@ data class RemoteFile(
|
|||||||
var sharedWithSharee: Boolean = false,
|
var sharedWithSharee: Boolean = false,
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
|
// TODO: Quotas not used. Use or remove them.
|
||||||
init {
|
init {
|
||||||
require(!(remotePath.isEmpty() || !remotePath.startsWith(File.separator))) { "Trying to create a OCFile with a non valid remote path: $remotePath" }
|
require(!(remotePath.isEmpty() || !remotePath.startsWith(File.separator))) { "Trying to create a OCFile with a non valid remote path: $remotePath" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to find out if this file is a folder.
|
||||||
|
*
|
||||||
|
* @return true if it is a folder
|
||||||
|
*/
|
||||||
|
val isFolder
|
||||||
|
get() = mimeType == MIME_DIR || mimeType == MIME_DIR_UNIX
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
const val MIME_DIR = "DIR"
|
||||||
|
const val MIME_DIR_UNIX = "httpd/unix-directory"
|
||||||
|
|
||||||
fun getRemoteFileFromDav(davResource: Response, userId: String, userName: String): RemoteFile {
|
fun getRemoteFileFromDav(davResource: Response, userId: String, userName: String): RemoteFile {
|
||||||
val remotePath = getRemotePathFromUrl(davResource.href, userId)
|
val remotePath = getRemotePathFromUrl(davResource.href, userId)
|
||||||
val remoteFile = RemoteFile(remotePath = remotePath, owner = userName)
|
val remoteFile = RemoteFile(remotePath = remotePath, owner = userName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user