Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Can you add support for relative paths for images? #10

Open
elbruno opened this issue May 19, 2013 · 3 comments
Open

Can you add support for relative paths for images? #10

elbruno opened this issue May 19, 2013 · 3 comments

Comments

@elbruno
Copy link

elbruno commented May 19, 2013

Hi
something like this

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

Thanks!
Regards

@lukesdm
Copy link
Owner

lukesdm commented Jun 1, 2013

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).

@Llaves
Copy link

Llaves commented Feb 25, 2014

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
Copy link

Llaves commented Feb 27, 2014

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;
        }
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants