Skip to content

Commit

Permalink
Fix to issue vtfuture#61 regarding relative file paths not resolving …
Browse files Browse the repository at this point in the history
…correctly
  • Loading branch information
unknown authored and unknown committed Sep 9, 2015
1 parent 81a3e1f commit 74dd343
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public override List<Bundle> ParseConfigs()
var processor = new ScriptProcessor(relativePath, fileText, Configuration);
processor.Process();
var result = processor.ProcessedString;
var dependencies = processor.Dependencies.Select(r => this.ResolvePhysicalPath(r)).Where(r => r != null).Distinct().ToList();
var fileDirectory = new FileInfo(file).DirectoryName;
var dependencies = processor.Dependencies.Select(r => this.ResolvePhysicalPath(r, fileDirectory)).Where(r => r != null).Distinct().ToList();
tempFileList.Add(new RequireFile
{
Name = file,
Expand Down
7 changes: 6 additions & 1 deletion RequireJsNet.Compressor/RequireProcessing/ConfigProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal abstract class ConfigProcessor

public abstract List<Bundle> ParseConfigs();

protected string ResolvePhysicalPath(string relativePath)
protected string ResolvePhysicalPath(string relativePath, string directory = "")
{
string entry = this.EntryPoint;
if (!string.IsNullOrEmpty(EntryOverride))
Expand All @@ -52,6 +52,11 @@ protected string ResolvePhysicalPath(string relativePath)
relativePath = relativePath.Substring(1);
}

if (relativePath.StartsWith("./") && !string.IsNullOrEmpty(directory))
{
relativePath = directory + "/" + relativePath.Substring(2);
}

string filePath;

try
Expand Down

0 comments on commit 74dd343

Please sign in to comment.