mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[ijent] IJPL-155713: Implement moving of files via IJent
GitOrigin-RevId: 2f5c4235b174d25a5a9744f91860af5f757e8e2f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a846f5684b
commit
64e103ff99
@@ -244,7 +244,23 @@ class IjentNioFileSystemProvider : FileSystemProvider() {
|
||||
}
|
||||
|
||||
override fun move(source: Path, target: Path, vararg options: CopyOption?) {
|
||||
TODO("Not yet implemented")
|
||||
ensureIjentNioPath(source)
|
||||
ensureIjentNioPath(target)
|
||||
val sourcePath = source.ijentPath
|
||||
val targetPath = target.ijentPath
|
||||
ensurePathIsAbsolute(sourcePath)
|
||||
ensurePathIsAbsolute(targetPath)
|
||||
return fsBlocking {
|
||||
try {
|
||||
source.nioFs.ijentFs.move(
|
||||
sourcePath,
|
||||
targetPath,
|
||||
replaceExisting = true,
|
||||
followLinks = LinkOption.NOFOLLOW_LINKS !in options)
|
||||
} catch (e : IjentFileSystemApi.MoveException) {
|
||||
e.throwFileSystemException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun isSameFile(path: Path, path2: Path): Boolean {
|
||||
|
||||
@@ -236,6 +236,19 @@ sealed interface IjentFileSystemApi {
|
||||
class TargetDirNotEmpty(where: IjentPath.Absolute) : CopyException(where, "Target directory is not empty"), IjentFsError.DirNotEmpty
|
||||
class Other(where: IjentPath.Absolute, additionalMessage: @NlsSafe String) : CopyException(where, additionalMessage), IjentFsError.Other
|
||||
}
|
||||
|
||||
@Throws(MoveException::class)
|
||||
suspend fun move(source: IjentPath.Absolute, target: IjentPath.Absolute, replaceExisting: Boolean, followLinks: Boolean)
|
||||
|
||||
sealed class MoveException(where: IjentPath.Absolute, additionalMessage: @NlsSafe String) : IjentFsIOException(where, additionalMessage) {
|
||||
class SourceDoesNotExist(where: IjentPath.Absolute) : MoveException(where, "Source does not exist"), IjentFsError.DoesNotExist
|
||||
class TargetAlreadyExists(where: IjentPath.Absolute) : MoveException(where, "Target already exists"), IjentFsError.AlreadyExists
|
||||
class PermissionDenied(where: IjentPath.Absolute) : MoveException(where, "Permission denied"), IjentFsError.PermissionDenied
|
||||
class NameTooLong(where: IjentPath.Absolute) : MoveException(where, "Name too long"), IjentFsError.NameTooLong
|
||||
class ReadOnlyFileSystem(where: IjentPath.Absolute) : MoveException(where, "File system is read-only"), IjentFsError.ReadOnlyFileSystem
|
||||
class FileSystemError(where: IjentPath.Absolute, additionalMessage: @NlsSafe String) : MoveException(where, additionalMessage), IjentFsError.Other
|
||||
class Other(where: IjentPath.Absolute, additionalMessage: @NlsSafe String) : MoveException(where, additionalMessage), IjentFsError.Other
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface IjentOpenedFile {
|
||||
|
||||
Reference in New Issue
Block a user