Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-7514

Add support for loading resources from classpath to scala.io.Source

    Details

    • Type: Improvement
    • Status: CLOSED
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.1
    • Fix Version/s: Scala 2.12.0-M2
    • Component/s: Library (Misc)
    • Labels:
      None

      Description

      Add support for loading Source from classpath. I use this feature a lot in Spring. Here is Spring Version:

      http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/core/io/ClassPathResource.html

      i propose to add function scala.io.Source.fromClassPath()

        Attachments

          Activity

          Hide
          s11001001 Stephen Compall added a comment -

          How would this improve matters over the existing Source.fromURL?

          Show
          s11001001 Stephen Compall added a comment - How would this improve matters over the existing Source.fromURL?
          Hide
          hsn Radim Kolar added a comment -

          fromURL supports spring like "classpath:package.resource" ?

          Show
          hsn Radim Kolar added a comment - fromURL supports spring like "classpath:package.resource" ?
          Hide
          retronym Jason Zaugg added a comment -

          Nope, it doesn't. I agree that this is a useful enhancement.

          Show
          retronym Jason Zaugg added a comment - Nope, it doesn't. I agree that this is a useful enhancement.
          Hide
          hsn Radim Kolar added a comment -

          My most used way to use that is with ClassPathResource(String path, Class<?> clazz)

          It creates classpathresource with name relative to supplied class

          Show
          hsn Radim Kolar added a comment - My most used way to use that is with ClassPathResource(String path, Class<?> clazz) It creates classpathresource with name relative to supplied class
          Hide
          sethtisue Seth Tisue added a comment -

          https://github.com/scala/scala/pull/4538 was submitted by Eugene Dzhurinsky, but against 2.11. a new PR could be submitted against 2.12

          Show
          sethtisue Seth Tisue added a comment - https://github.com/scala/scala/pull/4538 was submitted by Eugene Dzhurinsky, but against 2.11. a new PR could be submitted against 2.12
          Show
          moors Adriaan Moors added a comment - https://github.com/scala/scala/pull/4561

            People

            • Assignee:
              jdevelop Eugene Dzhurinsky
              Reporter:
              hsn Radim Kolar
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: