Skip to content

Commit

Permalink
- Fixed false positive of OutOfDate detection. Caused by the imported…
Browse files Browse the repository at this point in the history
… files stored in the script file stamp without full path
  • Loading branch information
oleg-shilo committed Dec 27, 2022
1 parent 3b0bba7 commit 2c0642b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
11 changes: 9 additions & 2 deletions src/cscs/ScriptParser.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using csscript;
using CSScripting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using csscript;
using CSScripting;

namespace CSScriptLib
{
Expand Down Expand Up @@ -254,6 +254,12 @@ void ProcessFile(ScriptInfo fileInfo)
{
importedFile.ProcessFile(); //parse now namespaces, ref. assemblies and scripts; also it will do namespace renaming


this.SearchDirs = this.SearchDirs.ToList()
.AddIfNotThere(importedFile.fileName.GetDirName())
.ToArray();


this.fileParsers.Add(importedFile);
this.fileParsers.Sort(fileComparer);

Expand Down Expand Up @@ -284,6 +290,7 @@ void ProcessFile(ScriptInfo fileInfo)
dirs.Add(Path.GetFullPath(dir));
else
dirs.Add(Path.Combine(Path.GetDirectoryName(importedFile.fileName), dir));

this.SearchDirs = dirs.ToArray();
}
else
Expand Down
26 changes: 5 additions & 21 deletions src/cscs/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@

#endregion Licence...

using csscript;
using CSScripting.CodeDom;
using CSScriptLib;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using static System.Environment;
using System.Globalization;
using System.IO;
using System.Linq;
Expand All @@ -43,9 +45,7 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using csscript;
using CSScripting.CodeDom;
using CSScriptLib;
using static System.Environment;

namespace CSScripting
{
Expand Down Expand Up @@ -1639,23 +1639,7 @@ public string[] AddItems(string[] files, bool isAssembly, string[] searchDirs)
else
{
foreach (string file in files)
{
string fullPath = Path.GetFullPath(file);

bool local = false;

foreach (string dir in searchDirs)
{
local = dir.SamePathAs(fullPath.GetDirName());
if (local)
break;
}

if (local)
AddItem(Path.GetFileName(file), File.GetLastWriteTimeUtc(file), false);
else
AddItem(file, File.GetLastWriteTimeUtc(file), false);
}
AddItem(file, File.GetLastWriteTimeUtc(file), false);
}
return newProbingDirs.ToArray();
}
Expand Down

0 comments on commit 2c0642b

Please sign in to comment.