Example #1
0
		internal static string MakeAbsolutePath(OutputRelative rel, string path, IDictionary<string, string> namedValues)
		{
			if (String.IsNullOrEmpty(path))
				path = @".\";

			path = Utils.FileUtils.ExpandEnvironment(path);
            if (path.IndexOf('$') >= 0)
            {
                path = Transform(path, MakefileMacro,
                    delegate(Match m)
                    {
                        string name = m.Groups["field"].Value;
                        if (namedValues.ContainsKey(name))
                            return namedValues[name];
                        return m.Value; //unknown
                    }
                );
            }

			if( Path.IsPathRooted(path)) 
				return path;

			switch (rel)
			{
				case OutputRelative.None: return path;//no-translation
				case OutputRelative.FixedPath: return Util.GetFullPath( path );
				case OutputRelative.RelativeCSBuildExe:
                    { return Util.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path)); }
				case OutputRelative.RelativeWorkingDir:
                    { return Util.GetFullPath(Path.Combine(Environment.CurrentDirectory, path)); }
				//case OutputRelative.RelativeProject:
			}
			throw new NotImplementedException();
		}
Example #2
0
        internal static string MakeAbsolutePath(OutputRelative rel, string path, IDictionary <string, string> namedValues)
        {
            if (String.IsNullOrEmpty(path))
            {
                path = @".\";
            }

            path = Utils.FileUtils.ExpandEnvironment(path);
            if (path.IndexOf('$') >= 0)
            {
                path = Transform(path, MakefileMacro,
                                 delegate(Match m)
                {
                    string name = m.Groups["field"].Value;
                    if (namedValues.ContainsKey(name))
                    {
                        return(namedValues[name]);
                    }
                    return(m.Value);    //unknown
                }
                                 );
            }

            if (Path.IsPathRooted(path))
            {
                return(path);
            }

            switch (rel)
            {
            case OutputRelative.None: return(path);                   //no-translation

            case OutputRelative.FixedPath: return(Util.GetFullPath(path));

            case OutputRelative.RelativeCSBuildExe:
            { return(Util.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path))); }

            case OutputRelative.RelativeWorkingDir:
            { return(Util.GetFullPath(Path.Combine(Environment.CurrentDirectory, path))); }
                //case OutputRelative.RelativeProject:
            }
            throw new NotImplementedException();
        }