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.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.io.path.absolute
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
|
|
||||||
@ -1315,11 +1316,14 @@ $repeatLabel lda $counterVar
|
|||||||
assemblyLines.add(sourcecode.trimEnd().trimStart('\n'))
|
assemblyLines.add(sourcecode.trimEnd().trimStart('\n'))
|
||||||
}
|
}
|
||||||
"%asmbinary" -> {
|
"%asmbinary" -> {
|
||||||
|
val includedName = stmt.args[0].str!!
|
||||||
val offset = if(stmt.args.size>1) ", ${stmt.args[1].int}" else ""
|
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 length = if(stmt.args.size>2) ", ${stmt.args[2].int}" else ""
|
||||||
val includedSourcePath = stmt.definingModule().source.resolveSibling(stmt.args[0].str)
|
val includedPath = stmt.definingModule().source.resolveSibling(includedName)
|
||||||
val relPath = Paths.get("").relativize(includedSourcePath)
|
val pathForAssembler = Paths.get("")
|
||||||
out(" .binary \"$relPath\" $offset $length")
|
.absolute() // avoid IllegalArgumentExc in case non-absolute path .relativize(absolute path)
|
||||||
|
.relativize(includedPath)
|
||||||
|
out(" .binary \"$pathForAssembler\" $offset $length")
|
||||||
}
|
}
|
||||||
"%breakpoint" -> {
|
"%breakpoint" -> {
|
||||||
val label = "_prog8_breakpoint_${breakpointLabels.size+1}"
|
val label = "_prog8_breakpoint_${breakpointLabels.size+1}"
|
||||||
|
Loading…
Reference in New Issue
Block a user