Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
WellRedPandit committed Apr 10, 2017
1 parent 330f238 commit 2dd18d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project/Deps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object V {
val scalaXml = "1.0.6"
val scopt = "3.5.0"
val slf4j = "1.7.25"
val tron = "1.0.5"
val tron = "1.0.6"
}

object Deps {
Expand Down
9 changes: 6 additions & 3 deletions src/main/scala/wrp/smehotron/Smehotron.scala
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,22 @@ object Smehotron extends LazyLogging {
}
}

def resolve(f: File): String = {
def resolve(f: File, sep: String = File.separator): String = {
val extend = Set("catalog", "sch-driver","source", "expected-svrl")
val sax = new SAXBuilder()
val doc = sax.build(f)
// http://stackoverflow.com/a/23870306
val rx = if( sep == "/") "\\\\+" else "/+"
val sub = if( sep == "/") "/" else "\\\\"
def _resolve(e: Element): Unit = {
for( e <- e.getChildren.asScala) {
if(extend.contains(e.getName)) {
val base = findBase(e)
if( base.nonEmpty) {
val newPath = (base.get + File.separator + e.getText).replaceAll(raw"[/\\]+", File.separator)
val newPath = (base.get + sep + e.getText).replaceAll(rx, sub)
e.setText(newPath)
} else {
e.setText(e.getText.replaceAll(raw"[/\\]+", File.separator))
e.setText(e.getText.replaceAll(rx, sub))
}
}
_resolve(e)
Expand Down

0 comments on commit 2dd18d9

Please sign in to comment.