Exemplo n.º 1
0
        protected virtual Tuple <string, string> GetOutputPath(XDocument doc, string configuration, string platform)
        {
            var nodes = from n in doc.Descendants()
                        where n.Name.LocalName == ProjectProperties.OUTPUT_PATH_PROP &&
                        EvaluateCondition(n.Parent.Attribute("Condition").Value)
                        select n;

            if (nodes.Count() != 1)
            {
                Bridge.Translator.TranslatorException.Throw("Unable to determine output path");
            }

            var projectPath = nodes.First().Value;
            var fullPath    = projectPath;

            if (!Path.IsPathRooted(fullPath))
            {
                fullPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Location), fullPath));
            }

            var configHelper = new Bridge.Contract.ConfigHelper();

            fullPath    = configHelper.ConvertPath(fullPath);
            projectPath = configHelper.ConvertPath(projectPath);

            return(new Tuple <string, string>(projectPath, fullPath));
        }
Exemplo n.º 2
0
        private string GetRelativePath(string filespec, string folder)
        {
            Uri pathUri = new Uri(filespec);

            // Folders must end in a slash
            if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                folder += Path.DirectorySeparatorChar;
            }

            Uri folderUri = new Uri(folder);

            var path = folderUri.MakeRelativeUri(pathUri).ToString();

            path = new Bridge.Contract.ConfigHelper().ConvertPath(path, '/');

            return(Uri.UnescapeDataString(path));
        }
Exemplo n.º 3
0
        protected virtual string GetOutputPaths(XDocument doc)
        {
            var configHelper = new Bridge.Contract.ConfigHelper();

            var outputPath = this.ProjectProperties.OutputPath;

            if (outputPath == null && this.ShouldReadProjectFile)
            {
                // Read OutputPath if not defined already
                // Throw exception if not found
                outputPath = ReadProperty(doc, ProjectPropertyNames.OUTPUT_PATH_PROP, false, configHelper);
            }

            if (outputPath == null)
            {
                outputPath = string.Empty;
            }

            this.ProjectProperties.OutputPath = outputPath;

            var outDir = this.ProjectProperties.OutDir;

            if (outDir == null && this.ShouldReadProjectFile)
            {
                // Read OutDir if not defined already
                outDir = ReadProperty(doc, ProjectPropertyNames.OUT_DIR_PROP, true, configHelper);
            }

            // If OutDir value is not found then use OutputPath value
            this.ProjectProperties.OutDir = outDir ?? outputPath;

            var fullPath = this.ProjectProperties.OutDir;

            if (!Path.IsPathRooted(fullPath))
            {
                fullPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Location), fullPath));
            }

            fullPath = configHelper.ConvertPath(fullPath);

            return(fullPath);
        }
Exemplo n.º 4
0
        protected virtual string GetOutputPath(XDocument doc, string configuration)
        {
            var nodes = from n in doc.Descendants()
                        where n.Name.LocalName == ProjectProperties.OutputPath &&
                        n.Parent.Attribute("Condition").Value.Contains(configuration)
                        select n;

            if (nodes.Count() != 1)
            {
                Bridge.Translator.TranslatorException.Throw("Unable to determine output path");
            }

            var path = nodes.First().Value;

            if (!Path.IsPathRooted(path))
            {
                path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Location), path));
            }

            path = new Bridge.Contract.ConfigHelper().ConvertPath(path);

            return(path);
        }