mirror of
https://github.com/irmen/prog8.git
synced 2024-08-19 14:29:17 +00:00
* fix #54 / step 1: relativize threw IllegalArgumentException if called on non-absolute path with absolute path as argument ("different type of path")
This commit is contained in:
parent
ee115b3337
commit
23c99002c0
@ -18,6 +18,7 @@ import java.nio.file.Paths
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
import kotlin.io.path.absolute
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
|
||||
@ -1315,11 +1316,14 @@ $repeatLabel lda $counterVar
|
||||
assemblyLines.add(sourcecode.trimEnd().trimStart('\n'))
|
||||
}
|
||||
"%asmbinary" -> {
|
||||
val includedName = stmt.args[0].str!!
|
||||
val offset = if(stmt.args.size>1) ", ${stmt.args[1].int}" else ""
|
||||
val length = if(stmt.args.size>2) ", ${stmt.args[2].int}" else ""
|
||||
val includedSourcePath = stmt.definingModule().source.resolveSibling(stmt.args[0].str)
|
||||
val relPath = Paths.get("").relativize(includedSourcePath)
|
||||
out(" .binary \"$relPath\" $offset $length")
|
||||
val includedPath = stmt.definingModule().source.resolveSibling(includedName)
|
||||
val pathForAssembler = Paths.get("")
|
||||
.absolute() // avoid IllegalArgumentExc in case non-absolute path .relativize(absolute path)
|
||||
.relativize(includedPath)
|
||||
out(" .binary \"$pathForAssembler\" $offset $length")
|
||||
}
|
||||
"%breakpoint" -> {
|
||||
val label = "_prog8_breakpoint_${breakpointLabels.size+1}"
|
||||
|
Loading…
Reference in New Issue
Block a user