SmartSprites

FileNotFoundException when using relative paths on Windows

Details

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

    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.

    Show
    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 - 12/Dec/09 09:38 PM

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 - 12/Dec/09 09:38 PM 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

Dates

  • Created:
    12/Dec/09 07:55 PM
    Updated:
    12/Dec/09 09:38 PM
    Resolved:
    12/Dec/09 09:38 PM

Time Tracking

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