js-cfb/bits/44_findpath.js
SheetJS fcc05e3567 version bump 0.10.2: proper directory/FAT analysis
- reprocess directory sector lists if not available
- search now strips out OLE metacharacters \0-\5
- strip sourceMappingURL references from minified scripts (h/t @vinin3)
- added xlscfb.js for js-xls
2014-11-02 23:02:42 -05:00

18 lines
808 B
JavaScript

/* [MS-CFB] 2.6.4 */
function make_find_path(FullPaths, Paths, FileIndex, files, root_name) {
var UCFullPaths = new Array(FullPaths.length);
var UCPaths = new Array(Paths.length), i;
for(i = 0; i < FullPaths.length; ++i) UCFullPaths[i] = FullPaths[i].toUpperCase().replace(chr0,'').replace(chr1,'!');
for(i = 0; i < Paths.length; ++i) UCPaths[i] = Paths[i].toUpperCase().replace(chr0,'').replace(chr1,'!');
return function find_path(path) {
var k;
if(path.charCodeAt(0) === 47 /* "/" */) { k=true; path = root_name + path; }
else k = path.indexOf("/") !== -1;
var UCPath = path.toUpperCase().replace(chr0,'').replace(chr1,'!');
var w = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
if(w === -1) return null;
return k === true ? FileIndex[w] : files[Paths[w]];
};
}