2014-06-24 04:00:39 +00:00
|
|
|
/* [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;
|
2014-11-03 04:02:42 +00:00
|
|
|
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,'!');
|
2017-02-24 05:11:45 +00:00
|
|
|
return function find_path(path/*:string*/) {
|
2014-06-24 04:00:39 +00:00
|
|
|
var k;
|
|
|
|
if(path.charCodeAt(0) === 47 /* "/" */) { k=true; path = root_name + path; }
|
|
|
|
else k = path.indexOf("/") !== -1;
|
2014-11-03 04:02:42 +00:00
|
|
|
var UCPath = path.toUpperCase().replace(chr0,'').replace(chr1,'!');
|
2014-06-24 04:00:39 +00:00
|
|
|
var w = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
|
|
|
|
if(w === -1) return null;
|
|
|
|
return k === true ? FileIndex[w] : files[Paths[w]];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|