tuxji commented on code in PR #1067:
URL: https://github.com/apache/daffodil/pull/1067#discussion_r1293728937


##########
daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala:
##########
@@ -226,14 +226,30 @@ class CLIConf(arguments: Array[String], stdout: 
PrintStream, stderr: PrintStream
   implicit def rootNSConverter = 
org.rogach.scallop.singleArgConverter[RefQName](qnameConvert _)
 
   implicit def fileResourceURIConverter = singleArgConverter[URI]((s: String) 
=> {
-    val file = new File(s)
-    val uri =
-      if (file.isFile()) {
-        Some(file.toURI)
-      } else {
-        Misc.getResourceRelativeOption(s, None)
+    val optURI = None
+      .orElse {
+        val file = new File(s)
+        if (file.isFile) Some(file.toURI)
+        else None
+      }
+      .orElse {
+        if (s.startsWith("/")) {
+          val resource = this.getClass.getResource(s)
+          Option(resource.toURI)
+        } else {
+          None
+        }
+      }
+      .orElse {
+        val resource = this.getClass.getResource("/" + s)
+        if (resource != null) {
+          Logger.log.warn(s"Found relative path on classpath absolutely, did 
you mean /$s")
+          Some(resource.toURI)

Review Comment:
   Your reasoning makes sense to me - let's just add a comment to this orElse 
block saying the entire block is fallback support that we may remove a few 
releases later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to