mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-15 11:13:50 +00:00
Fixed resources support being broken in nib2cib.
Reviewed by me.
This commit is contained in:
1 parent
8990f6c387
commit
da9221bf71
2 files changed
+19
-7
No files matched your search
@@ -41,7 +41,7 @@ importClass(javax.imageio.ImageIO);
|
||||
|
||||
var size = CGSizeMakeZero();
|
||||
|
||||
if (![aCoder resourcesFile])
|
||||
if (![[aCoder resourcesPath] length])
|
||||
{
|
||||
CPLog.warn("***WARNING: Resources found in nib, but no resources path specified with -R option.");
|
||||
|
||||
@@ -53,15 +53,16 @@ importClass(javax.imageio.ImageIO);
|
||||
|
||||
if (!resourcePath)
|
||||
CPLog.warn("***WARNING: Resource named " + _resourceName + " not found in supplied resources path.");
|
||||
|
||||
else
|
||||
{
|
||||
var imageStream = ImageIO.createImageInputStream(new Packages.java.io.File(resourcePath).getCanonicalFile()),
|
||||
readers = ImageIO.getImageReaders(imageStream),
|
||||
reader = null;
|
||||
|
||||
|
||||
if(readers.hasNext())
|
||||
reader = readers.next();
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
imageStream.close();
|
||||
|
||||
@@ -27,7 +27,7 @@ var File = require("file");
|
||||
|
||||
@implementation Nib2CibKeyedUnarchiver : CPKeyedUnarchiver
|
||||
{
|
||||
CPString resourcesPath;
|
||||
CPString resourcesPath @accessors(readonly);
|
||||
}
|
||||
|
||||
- (id)initForReadingWithData:(CPData)data resourcesPath:(CPString)aResourcesPath
|
||||
@@ -50,7 +50,7 @@ var File = require("file");
|
||||
if (!resourcesPath)
|
||||
return NULL;
|
||||
|
||||
var pathGroups = [File.list(resourcesPath)];
|
||||
var pathGroups = [File.listPaths(resourcesPath)];
|
||||
|
||||
while (pathGroups.length > 0)
|
||||
{
|
||||
@@ -60,13 +60,13 @@ var File = require("file");
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var path = files[index];
|
||||
var path = paths[index];
|
||||
|
||||
if (File.basename(path) === aName)
|
||||
return path;
|
||||
|
||||
if (File.isDirectory(path))
|
||||
pathGroups.push(File.list(path));
|
||||
pathGroups.push(File.listPaths(path));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,3 +74,14 @@ var File = require("file");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
File.listPaths = function(aPath)
|
||||
{
|
||||
var paths = File.list(aPath),
|
||||
count = paths.length;
|
||||
|
||||
while (count--)
|
||||
paths[count] = File.join(aPath, paths[count]);
|
||||
|
||||
return paths;
|
||||
}
|
||||
Reference in new issue
Block a user