image-comments icon indicating copy to clipboard operation
image-comments copied to clipboard

Can you add support for relative paths for images?

Open elbruno opened this issue 11 years ago • 3 comments

Hi something like this

/// <summary>
/// <image url=".\images\sampleCall.png" />
/// </summary>
private VideoChannel videoChannel;

Thanks! Regards

elbruno avatar May 19 '13 18:05 elbruno

Thanks for your suggestion. This should be feasible to implement in a future version. P.S. I edited your comment for code formatting to get the xml tags to show (you just need to indent each line by 4 spaces).

lukesdm avatar Jun 01 '13 13:06 lukesdm

Any chance this is going to happen? My build configuration is outside my control, so being able to use a path relative to the source file rather than $(ProjectDir) or an absolute path is very important to me.

Llaves avatar Feb 25 '14 05:02 Llaves

Here's a patch to VariableExpander.cs that allows the use of the variable $(CurrentDir) to point to the directory of the document. There's probably a prettier way, but I'm not a C# programmer.

    private const string PROJECTDIR_PATTERN = "$(ProjectDir)";
    private const string SOLUTIONDIR_PATTERN = "$(SolutionDir)";
    private const string CURRENTDIR_PATTERN = "$(CurrentDir)";

....

    private string evaluator(Match match)
    {
        string variableName = match.Value;
        if (string.Compare(variableName, PROJECTDIR_PATTERN, StringComparison.InvariantCultureIgnoreCase) == 0)
        {
            return _projectDirectory;
        }
        else if (string.Compare(variableName, SOLUTIONDIR_PATTERN, StringComparison.InvariantCultureIgnoreCase) == 0)
        {
            return _solutionDirectory;
        }
        else if (string.Compare(variableName, CURRENTDIR_PATTERN, StringComparison.InvariantCultureIgnoreCase) == 0)
        {
          ITextDocument document;
          _view.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document);
          return Path.GetDirectoryName(document.FilePath) + @"\";
        }
        else
        {
            // Could throw an exception here, but it's possible the path contains $(...).
            // TODO: Variable name escaping
            return variableName;
        }
    }

Llaves avatar Feb 27 '14 23:02 Llaves