SmartSprites
  1. SmartSprites
  2. SMARTSPRITES-59

FileNotFoundException when using relative paths on Windows

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.2.5
    • Fix Version/s: 0.2.6
    • Labels:
      None

      Description

      When you call SmartSprites with a relative path on Windows it will crash, although the absolute path works fine.

      e.g. C:\workspace\smartsprites>smartsprites.cmd ..\web\WebSite\Root

      will produce:

      Exception in thread "main" java.io.FileNotFoundException: C:\workspace\web\
      WebSite\Root (Access is denied)
             at java.io.FileInputStream.open(Native Method)
             at java.io.FileInputStream.<init>(Unknown Source)
             at org.carrot2.labs.smartsprites.resource.FileSystemResourceHandler.getResourceAsInputStream(FileSystemResourceHandler.java:54)
             at org.carrot2.labs.smartsprites.resource.FileSystemResourceHandler.getResourceAsReader(FileSystemResourceHandler.java:61)
             at org.carrot2.labs.smartsprites.SpriteDirectiveOccurrenceCollector.collectSpriteImageOccurrences(SpriteDirectiveOccurrenceCollector.java:55)
             at org.carrot2.labs.smartsprites.SpriteDirectiveOccurrenceCollector.collectSpriteImageOccurrences(SpriteDirectiveOccurrenceCollector.java:164)
             at org.carrot2.labs.smartsprites.SpriteBuilder.buildSprites(SpriteBuilder.java:151)
             at org.carrot2.labs.smartsprites.SpriteBuilder.buildSprites(SpriteBuilder.java:121)
             at org.carrot2.labs.smartsprites.SmartSprites.main(SmartSprites.java:46)
      

      and C:\workspace\smartsprites>smartsprites.cmd C:\workspace\web\WebSite\Root functions well.

        Activity

        Hide
        Stanisław Osiński added a comment -

        The problem with the above invocation (actually with both, I'm not sure if the latter would work either) was that SmartSprites expected a file as an argument, but got a directory. To provide the directory with CSS files, use the --root-dir-path parameter. See http://csssprites.org/#global-options for more information on these options.

        I've added some extra checks to produce more meaningful messages in such cases. I also improved handling of relative --root-dir-path a bit.

        Show
        Stanisław Osiński added a comment - The problem with the above invocation (actually with both, I'm not sure if the latter would work either) was that SmartSprites expected a file as an argument, but got a directory. To provide the directory with CSS files, use the --root-dir-path parameter. See http://csssprites.org/#global-options for more information on these options. I've added some extra checks to produce more meaningful messages in such cases. I also improved handling of relative --root-dir-path a bit.

          People

          • Assignee:
            Stanisław Osiński
            Reporter:
            Stanisław Osiński
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 1h
              1h

                Development