make() public static method

public static make ( ) : UnknownPodErr
return UnknownPodErr
Exemplo n.º 1
0
        public static Pod doFind(string name, bool check, FPod fpod)
        {
            try
            {
                lock (m_podsByName)
                {
                    // TODO - .NET does not have soft references, so how could
                    // we implement this?  See the Pod.java for the java impl.

                    Pod pod = (Pod)m_podsByName[name];
                    if (pod == null)
                    {
                        // if fpod is non-null, then we are "creating" this pod in
                        // memory direct from the compiler, otherwise we need to
                        // find the pod zip file and load it's meta-data
                        if (fpod == null)
                        {
                            fpod = readFPod(name);
                        }

                        // sanity check
                        if (fpod.m_podName != name)
                        {
                            throw new Exception("Mismatched pod name b/w pod.def and pod zip filename: " + fpod.m_podName + " != " + name);
                        }

                        // create the pod and register it
                        pod = new Pod(fpod);
                        m_podsByName[name] = pod;
                    }
                    return(pod);
                }
            }
            catch (UnknownPodErr.Val e)
            {
                if (!check)
                {
                    return(null);
                }
                throw e;
            }
            catch (Exception e)
            {
                Err.dumpStack(e);
                if (!check)
                {
                    return(null);
                }
                throw UnknownPodErr.make(name, e).val;
            }
        }
Exemplo n.º 2
0
        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);
        }