Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 0.2.5
-
Fix Version/s: 0.2.6
-
Component/s: None
-
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.
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.