private void loadFiles() { lock (m_filesMap) { if (m_filesList != null) { return; } this.m_filesList = (List)fpod.m_store.podFiles(uri()).toImmutable(); for (int i = 0; i < m_filesList.sz(); ++i) { Fan.Sys.File f = (Fan.Sys.File)m_filesList.get(i); m_filesMap[f.uri()] = f; } } }
public static FPod readFPod(string name) { FStore store = null; // handle sys specially for bootstrapping the VM if (name == "sys") { store = new FStore(new ZipFile(FileUtil.combine(Sys.m_podsDir, name + ".pod"))); } // otherwise delegate to Env.cur to find the pod file else { FileSystemInfo file = null; Fan.Sys.File f = Env.cur().findPodFile(name); if (f != null) { file = ((LocalFile)f).m_file; } // if null or doesn't exist then its a no go if (file == null || !file.Exists) { throw UnknownPodErr.make(name).val; } // verify case since Windoze is case insensitive String actualName = file.Name; //getCanonicalFile().getName(); actualName = actualName.Substring(0, actualName.Length - 4); if (actualName != name) { throw UnknownPodErr.make("Mismatch case: " + name + " != " + actualName).val; } store = new FStore(new ZipFile(file.FullName)); } // read in the FPod tables FPod fpod = new FPod(name, store); fpod.read(); return(fpod); }
public Fan.Sys.File file(Uri uri, bool check) { loadFiles(); if (!uri.isPathAbs()) { throw ArgErr.make("Pod.files Uri must be path abs: " + uri).val; } if (uri.auth() != null && !uri.toStr().StartsWith(this.uri().toStr())) { throw ArgErr.make("Invalid base uri `" + uri + "` for `" + this.uri() + "`").val; } else { uri = this.uri().plus(uri); } Fan.Sys.File f = (Fan.Sys.File)m_filesMap[uri]; if (f != null || !check) { return(f); } throw UnresolvedErr.make(uri.toStr()).val; }