Issue Details (XML | Word | Printable)

Key: SMARTSPRITES-59
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Stanisław Osiński
Reporter: Stanisław Osiński
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
SmartSprites

FileNotFoundException when using relative paths on Windows

Created: 12/Dec/09 07:55 PM   Updated: 12/Dec/09 09:38 PM   Resolved: 12/Dec/09 09:38 PM
Component/s: None
Affects Version/s: 0.2.5
Fix Version/s: 0.2.6

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


 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.



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.