public static bool GatherDependencyFiles(ISVR_DependencyManifest manifest)
        {
            if (manifest == null)
            {
                return(false);
            }

            var dependencies = manifest.Dependencies;

            if (dependencies == null)
            {
                return(false);
            }

            if (!Directory.Exists(StagingRootPath))
            {
                Directory.CreateDirectory(StagingRootPath);
            }

            //erase any and all files located beneath the stagingRootPath;
            PurgeStagingRootPath(StagingRootPath);

            foreach (var dependency in dependencies)
            {
                //find the file located at the dependency URL
                var fullPath = Path.Combine(Application.streamingAssetsPath, dependency._url);

                if (File.Exists(fullPath))
                {
                    //Debug.Log("Found dependency:" + dependency._url);

                    //stuff this file into the staging folder so we can zip it into container with the metadata
                    var destinationPath = Path.Combine(StagingRootPath, dependency._url);
                    var directory       = Path.GetDirectoryName(destinationPath);

                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }

                    //hmm, if a previous actor's dependency is already copied here, then should
                    //we assume that the file already present is good to go? Yes, because
                    //the whole folder was just purged, so any file we find is extremely fresh
                    if (File.Exists(destinationPath))
                    {
                        //Debug.Log("since the dependency file " + destinationPath + " already exists, skipping.");
                        continue;
                    }

                    File.Copy(fullPath, destinationPath, true);
                }
                else
                {
                    Debug.LogWarning("failed to find the dependency file located at " + dependency._url);
                }
            }

            return(true);
        }
Exemple #2
0
 void PopulateDependencyManifest()
 {
     _dependencyManifest = new ISVR_DependencyManifest(ActorRecordCollection);
 }