mirror of
https://github.com/ij-plugins/ijp-imagej-launcher.git
synced 2024-11-13 16:29:01 -08:00
Remove workaround for Scala Native issue #3293, it was resolved in v.0.4.13
See https://github.com/scala-native/scala-native/issues/3293
This commit is contained in:
parent
c30b853f64
commit
8718c9310c
1 changed files with 6 additions and 21 deletions
|
|
@ -1,3 +1,8 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2023 Jarek Sacha. All Rights Reserved.
|
||||
* Author's e-mail: jpsacha at gmail.com
|
||||
*/
|
||||
|
||||
package ij_plugins.imagej_launcher
|
||||
|
||||
import os.{Path, RelPath}
|
||||
|
|
@ -23,8 +28,7 @@ object Updater:
|
|||
os.walk(updateDir)
|
||||
.filter(os.isFile)
|
||||
.foreach: src =>
|
||||
// val relativeDir = src.relativeTo(updateDir)
|
||||
val dst = ijDir / relativeTo(src, updateDir)
|
||||
val dst = ijDir / src.relativeTo(updateDir)
|
||||
if os.size(src) == 0 then
|
||||
logger.debug(s"remove: $dst")
|
||||
if !dryRun then os.remove(dst)
|
||||
|
|
@ -45,25 +49,6 @@ object Updater:
|
|||
ex.printStackTrace()
|
||||
Left(s"Failed to perform update: ${ex.getMessage} - ${ex.getClass.getSimpleName}")
|
||||
|
||||
private def relativeTo(src: Path, base: Path): RelPath =
|
||||
// This does what src.relativeTo(base) should do
|
||||
// Problems is in the native code on Windows,
|
||||
// os.Path#relativeTo creates relative path by adding `../` at the beginning of the absolute path,
|
||||
// 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 baseStr = base.toString
|
||||
require(baseStr.nonEmpty)
|
||||
require(srcStr.startsWith(baseStr))
|
||||
|
||||
val relStr = srcStr.drop(baseStr.length + 1)
|
||||
RelPath(relStr)
|
||||
|
||||
private def deleteEmptyDirs(dir: Path, logger: Logger): Unit =
|
||||
logger.debug(s"Cleaning directory: $dir")
|
||||
os.list(dir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue