Пример #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);
        }
Пример #2
0
        public override void CalculateSteps()
        {
            base.CalculateSteps();

            if (workspaceService.Exists(diskPath))
            {
                zipFileSystem = workspaceService.Get(diskPath).Value as ZipFileSystem;

                if (zipFileSystem == null || zipFileSystem.PhysicalRoot == null)
                {
                    return;
                }

                // Get the physical path
                physicalPath       = zipFileSystem.PhysicalRoot;
                physicalBackupPath = zipFileSystem.PhysicalRoot + ".bak";

                steps.Add(BackupZip);

                // Get all the files
                var srcFiles = zipFileSystem.GetEntitiesRecursive(WorkspacePath.Root).ToArray();

                // Convert files into the correct format: src/dest path
                var files = new Dictionary <WorkspacePath, WorkspacePath>();
                foreach (var file in srcFiles)
                {
                    files.Add(diskPath.AppendPath(file), file);
                }

                // Create the  zip exporter
                zipExporter = new ZipExporter(diskPath.Path, FileLoadHelper, files);

                // Calculate all the zip steps
                zipExporter.CalculateSteps();

                for (int i = 0; i < zipExporter.totalSteps; i++)
                {
                    steps.Add(NextZipStep);
                }

                // Save the disk
                steps.Add(SaveDisk);

                steps.Add(CheckForErrors);

                steps.Add(Cleanup);
            }
        }
 public bool OS_FileExists(string file)
 {
     return(workspace.Exists(WorkspacePath.Parse(file)));
 }