Skip to content

Commit 4121d1a

Browse files
authored
Merge pull request #753 from dotnet-script/bugfix/path-detection
fixed global tool path detection
2 parents be49954 + 9844fc7 commit 4121d1a

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: dotnet-script build/Build.csx
2424

2525
build-mac:
26-
runs-on: macos-latest
26+
runs-on: macos-13
2727

2828
steps:
2929
- uses: actions/checkout@v3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,4 @@ project.json
266266
/dotnet-script
267267
/.vscode
268268
/src/Dotnet.Script/Properties/launchSettings.json
269+
.DS_Store

src/Dotnet.Script.Core/Scaffolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void CreateLaunchConfiguration(string currentWorkingDirectory)
141141
_scriptConsole.WriteNormal("Creating VS Code launch configuration file");
142142
string pathToLaunchFile = Path.Combine(vsCodeDirectory, "launch.json");
143143
string installLocation = _scriptEnvironment.InstallLocation;
144-
bool isInstalledAsGlobalTool = installLocation.Contains(".dotnet/tools", StringComparison.OrdinalIgnoreCase);
144+
bool isInstalledAsGlobalTool = installLocation.Contains($".dotnet{Path.DirectorySeparatorChar}tools", StringComparison.OrdinalIgnoreCase);
145145
string dotnetScriptPath = Path.Combine(installLocation, "dotnet-script.dll").Replace(@"\", "/");
146146
string launchFileContent;
147147
if (!File.Exists(pathToLaunchFile))

src/Dotnet.Script.Tests/ScaffoldingTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void ShouldUpdatePathToDotnetScript()
179179
[Fact]
180180
public void ShouldCreateUnifiedLaunchFileWhenInstalledAsGlobalTool()
181181
{
182-
Scaffolder scaffolder = CreateTestScaffolder("somefolder/.dotnet/tools/dotnet-script");
182+
Scaffolder scaffolder = CreateTestScaffolder($"somefolder{Path.DirectorySeparatorChar}.dotnet{Path.DirectorySeparatorChar}tools{Path.DirectorySeparatorChar}dotnet-script");
183183

184184
using var scriptFolder = new DisposableFolder();
185185
scaffolder.InitializerFolder("main.csx", scriptFolder.Path);
@@ -191,7 +191,7 @@ public void ShouldCreateUnifiedLaunchFileWhenInstalledAsGlobalTool()
191191
public void ShouldUpdateToUnifiedLaunchFileWhenInstalledAsGlobalTool()
192192
{
193193
Scaffolder scaffolder = CreateTestScaffolder("some-install-folder");
194-
Scaffolder globalToolScaffolder = CreateTestScaffolder("somefolder/.dotnet/tools/dotnet-script");
194+
Scaffolder globalToolScaffolder = CreateTestScaffolder($"somefolder{Path.DirectorySeparatorChar}.dotnet{Path.DirectorySeparatorChar}tools{Path.DirectorySeparatorChar}dotnet-script");
195195
using var scriptFolder = new DisposableFolder();
196196
scaffolder.InitializerFolder("main.csx", scriptFolder.Path);
197197
var fileContent = File.ReadAllText(Path.Combine(scriptFolder.Path, ".vscode", "launch.json"));

src/Dotnet.Script.Tests/ScriptExecutionTests.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ public void ShouldSupportInlineNugetReferencesWithTrailingSemicoloninEvaluatedCo
250250

251251
[Theory]
252252
[InlineData("https://gist.githubusercontent.com/seesharper/5d6859509ea8364a1fdf66bbf5b7923d/raw/0a32bac2c3ea807f9379a38e251d93e39c8131cb/HelloWorld.csx",
253-
"Hello World")]
253+
"Hello World")]
254+
[InlineData("http://gist.githubusercontent.com/seesharper/5d6859509ea8364a1fdf66bbf5b7923d/raw/0a32bac2c3ea807f9379a38e251d93e39c8131cb/HelloWorld.csx",
255+
"Hello World")]
254256
[InlineData("https://github.com/dotnet-script/dotnet-script/files/5035247/hello.csx.gz",
255257
"Hello, world!")]
256258
public void ShouldExecuteRemoteScript(string url, string output)
@@ -259,14 +261,6 @@ public void ShouldExecuteRemoteScript(string url, string output)
259261
Assert.Contains(output, result.Output);
260262
}
261263

262-
[Fact]
263-
public void ShouldExecuteRemoteScriptUsingTinyUrl()
264-
{
265-
var url = "https://tinyurl.com/y8cda9zt";
266-
var (output, _) = ScriptTestRunner.Default.Execute(url);
267-
Assert.Contains("Hello World", output);
268-
}
269-
270264
[Fact]
271265
public void ShouldHandleIssue268()
272266
{

0 commit comments

Comments
 (0)