forked from cappuccino/cappuccino
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved support for resources in nib2cib.
Reviewed by me.
- Loading branch information
Francisco Ryan Tolmasky I
committed
Feb 1, 2009
1 parent
064a554
commit 9ec781f
Showing
3 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
@import <Foundation/CPKeyedUnarchiver.j> | ||
|
||
|
||
@implementation Nib2CibKeyedUnarchiver : CPKeyedUnarchiver | ||
{ | ||
File resourcesFile; | ||
} | ||
|
||
- (id)initForReadingWithData:(CPData)data resourcesFile:(File)aResourcesFile | ||
{ | ||
self = [super initForReadingWithData:data]; | ||
|
||
if (self) | ||
resourcesFile = aResourcesFile; | ||
|
||
return self; | ||
} | ||
|
||
- (File)resourcesFile | ||
{ | ||
return resourcesFile; | ||
} | ||
|
||
- (File)resourceFileForName:(CPString)aName | ||
{ | ||
var moreFiles = [resourcesFile.listFiles()]; | ||
|
||
do | ||
{ | ||
var files = moreFiles.shift(), | ||
index = 0, | ||
count = files.length; | ||
|
||
for (; index < count; ++index) | ||
{ | ||
var file = files[index].getCanonicalFile(), | ||
name = String(file.getName()); | ||
|
||
if (name === aName) | ||
return file; | ||
|
||
if (file.isDirectory()) | ||
moreFiles.push(file.listFiles()); | ||
} | ||
} | ||
while (moreFiles.length > 0) | ||
|
||
return NULL; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters