Beispiel #1
0
        public static string GenerateModuleSubfolderPath(ModuleHost module_host, string module_name, ModuleFileLocationType loc_type, string relative_path)//, string plugin_name = null)
        {
            //var source_path = GetUProjectSourceDirectory(proj);
            var source_path = module_host.SourceDirectory;

            // @todo: not necessarily, use of some kind of module identifier is better
            var module_path = Path.Combine(source_path, module_name);

            var base_path = module_path;

            switch (loc_type)
            {
            case ModuleFileLocationType.TopLevel:
                break;

            case ModuleFileLocationType.Public:
                base_path = Path.Combine(base_path, "Public");
                break;

            case ModuleFileLocationType.Private:
                base_path = Path.Combine(base_path, "Private");
                break;
            }

            return(Path.GetFullPath(
                       Path.Combine(base_path, relative_path)
                       ));
        }
Beispiel #2
0
        public static IEnumerable <ModuleRef> FindModulesInSourceFolder(string source_dir, ModuleHost host)
        {
            List <ModuleRef> modules = new List <ModuleRef>();

            if (Directory.Exists(source_dir))
            {
                var module_files = Directory.GetFiles(source_dir, "*.Build.cs", SearchOption.AllDirectories);
                foreach (var filename in module_files)
                {
                    string name = Path.GetFileName(filename);
                    var    idx  = name.IndexOf('.');
                    name       = name.Substring(0, idx);
                    source_dir = EnsureTrailingSeparator(source_dir);
                    string module_dir = EnsureTrailingSeparator(Path.GetDirectoryName(filename));
                    string relative   = MakeRelativePath(source_dir, module_dir);
                    modules.Add(new ModuleRef(name, host, relative));
                }
            }

            return(modules);
        }
Beispiel #3
0
 public ModuleRef(string name, ModuleHost host, string rel_path)
 {
     Name         = name;
     Host         = host;
     RelativePath = rel_path;
 }