Skip to content

fix(amazonq): Files.move will throw if src / dest are in different volumes #5733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts

import org.apache.commons.io.FileUtils
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.text.StringUtil
import com.intellij.util.io.DigestUtil
Expand Down Expand Up @@ -68,7 +69,7 @@ fun getSubFolders(basePath: Path): List<Path> = try {
fun moveFilesFromSourceToDestination(sourceDir: Path, targetDir: Path) {
try {
Files.createDirectories(targetDir.parent)
Files.move(sourceDir, targetDir, StandardCopyOption.REPLACE_EXISTING)
FileUtils.moveDirectory(sourceDir.toFile(), targetDir.toFile())
} catch (e: Exception) {
throw IllegalStateException("Failed to move files from $sourceDir to $targetDir", e)
}
Expand Down
Loading