stevedlawrence commented on code in PR #1067:
URL: https://github.com/apache/daffodil/pull/1067#discussion_r1293710285
##########
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:
My thinking was that when we want to remove this fallback support and result
in a normal "could not find schema" error, then we can just remove this orElse
block and nothing else needs to be modified. I don't feel strongly about this
though, I can merge the logic.
--
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]