Skip to content

Commit

Permalink
Use ChatGPT's code
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Sep 10, 2024
1 parent 7d64354 commit d81663d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import org.gradle.api.JavaVersion
import xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml
import java.io.IOException

import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardOpenOption
import java.nio.file.NoSuchFileException
import java.nio.file.StandardCopyOption

plugins {
java
Expand Down Expand Up @@ -181,9 +181,18 @@ tasks.register("renameProject") {
replaceStringInFile(buildFilePath, "val mainProjectAuthor = \"$mainProjectAuthor\"", "val mainProjectAuthor = \"$newAuthorName\"")
replaceStringInFile(buildFilePath, "val topLevelDomain = \"$topLevelDomain\"", "val topLevelDomain = \"$newTopLevelDomain\"")

Paths.get("$startPath/$currentGroupPath/$currentMainFileNameWithExtension").toFile().renameTo(
Paths.get("$startPath/$newGroupPath/$newMainFileNameWithExtension").toFile()
)
val currentMainFilePath = javaSourcePath.resolve(currentGroupPath).resolve(currentMainFileNameWithExtension)
val newMainFilePath = javaSourcePath.resolve(newGroupPath).resolve(newMainFileNameWithExtension)

try {
Files.move(currentMainFilePath.toPath(), newMainFilePath.toPath())
println("Renamed file successfully")
} catch (exception: IOException) {
exception.printStackTrace()
error("Failed to rename file")
}

// Ensure directories are renamed and other replacements are done similarly

renamePackageDirectories("${javaSourcePathString}/${currentGroupPath}", "${javaSourcePathString}/${newGroupPath}")

Expand Down

0 comments on commit d81663d

Please sign in to comment.