Skip to content

Commit

Permalink
Fix (attempt): Create link instead of symlink to avoid permissions is…
Browse files Browse the repository at this point in the history
…sue on Windows
  • Loading branch information
0ffz committed Mar 9, 2024
1 parent 45f9cb5 commit 8202bf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=2.0.0-alpha.10
version=2.0.0-alpha.11
idofrontVersion=0.22.3
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ object ModDownloader {
fun ModpackState.copyMods() {
// Clear mods folder
val existingEntries = instance.modsDir.useDirectoryEntries { files ->
files.filter { it.isSymbolicLink() || it.isRegularFile() }.toList()
files.filter { !it.isDirectory() }.toList()
}

val userMods = instance.userMods.listDirectoryEntries("*.jar")
Expand All @@ -114,10 +114,11 @@ object ModDownloader {
val linkDest = (instance.minecraftDir / relative)
if (!linkDest.isSymbolicLink()) linkDest.deleteIfExists()
if (linkDest.notExists())
linkDest.createSymbolicLinkPointingTo(absolute.relativeTo(linkDest.parent))
linkDest.createLinkPointingTo(absolute.relativeTo(linkDest.parent))
linkDest
}
.toSet()

(existingEntries - linked).forEach { it.deleteIfExists() }
}

Expand Down

0 comments on commit 8202bf2

Please sign in to comment.