mirror of
https://github.com/ij-plugins/ijp-imagej-launcher.git
synced 2024-11-13 16:29:01 -08:00
Update note on relativeTo workaround and the bug in Scala Native
See https://github.com/scala-native/scala-native/issues/3293
This commit is contained in:
parent
a91991593f
commit
78448de03d
1 changed files with 8 additions and 4 deletions
|
|
@ -48,9 +48,14 @@ object Updater:
|
||||||
|
|
||||||
private def relativeTo(src: Path, base: Path): RelPath =
|
private def relativeTo(src: Path, base: Path): RelPath =
|
||||||
// This does what src.relativeTo(base) should do
|
// This does what src.relativeTo(base) should do
|
||||||
// Problems is in the native code on Windows, it creates relative path by adding `../` at the beginning of the path
|
// Problems is in the native code on Windows,
|
||||||
// rather than creating a relative path
|
// os.Path#relativeTo creates relative path by adding `../` at the beginning of the absolute path,
|
||||||
// Implementation is very limited and assumes specific relation between src and base that should hold in our case
|
// co you may get `../C:\a\b` which leads to a exception soon after.
|
||||||
|
// The issue is with Scala Native implementation of java.nio.file.Path#relativize on Windows,
|
||||||
|
// See https://github.com/scala-native/scala-native/issues/3293
|
||||||
|
|
||||||
|
// This implementation is very limited but sufficient for our use.
|
||||||
|
// It assumes specific relation between src and base.
|
||||||
|
|
||||||
val srcStr = src.toString
|
val srcStr = src.toString
|
||||||
val baseStr = base.toString
|
val baseStr = base.toString
|
||||||
|
|
@ -60,7 +65,6 @@ object Updater:
|
||||||
val relStr = srcStr.drop(baseStr.length + 1)
|
val relStr = srcStr.drop(baseStr.length + 1)
|
||||||
RelPath(relStr)
|
RelPath(relStr)
|
||||||
|
|
||||||
|
|
||||||
private def deleteEmptyDirs(dir: Path, logger: Logger): Unit =
|
private def deleteEmptyDirs(dir: Path, logger: Logger): Unit =
|
||||||
logger.debug(s"Cleaning directory: $dir")
|
logger.debug(s"Cleaning directory: $dir")
|
||||||
os.list(dir)
|
os.list(dir)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue