예제 #1
0
        public string ResolveModuleName(string modname, Table globalContext)
        {
            if (!modname.EndsWith(".lua"))
            {
                modname = modname + ".lua";
            }

            if (modname.StartsWith("/"))
            {
                // TODO need to make sure this is an relative path
            }

            List <WorkspacePath> sharedLibPaths = _workspace.SharedLibDirectories();

            sharedLibPaths.Insert(0, WorkspacePath.Root.AppendDirectory("Game"));
            WorkspacePath filePath;

            foreach (var path in sharedLibPaths)
            {
                filePath = path.AppendFile(modname);
                if (_workspace.Exists(filePath))
                {
                    modname = _workspace.GetPhysicalPath(filePath);
                    break;
                }
            }

            // _workspace.GetPhysicalPath()

            return(modname);
        }