Skip to content

Commit

Permalink
fix symlink on Pre-Lollipop (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
pazos committed Jul 2, 2021
1 parent 8a21436 commit cc50db5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ fun File.symlink(link: String): Boolean {
Os.symlink(this.absolutePath, link)
return true
}
val os = Class.forName("libcore.io.Libcore").getDeclaredField("os")
os.isAccessible = true
os.get(null).javaClass.getMethod("symlink", String::class.java,
val libcore = Class.forName("libcore.io.Libcore")
val field = libcore.getDeclaredField("os")
field.isAccessible = true
val os = field.get(null)
os.javaClass.getMethod("symlink", String::class.java,
String::class.java).invoke(os, this.absolutePath, link)
return true
} catch (e: Exception) {
Expand Down

0 comments on commit cc50db5

Please sign in to comment.