⚡ Sangsakala Proxy 🏠 Home
Skip to content

Commit 188b4ac

Browse files
committed
Cli Mac OS compatibility fixes
1 parent ed9117f commit 188b4ac

5 files changed

Lines changed: 78 additions & 2 deletions

File tree

‎.vscode/launch.json‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceRoot}/src/NetCoreStack.Hisar.WebCli.Tools/bin/Debug/netcoreapp1.0/dotnet-hisar.dll",
14+
"args": ["--appdir", "../../test/Hosting"],
15+
"cwd": "${workspaceRoot}/src/NetCoreStack.Hisar.WebCli.Tools",
16+
"stopAtEntry": false,
17+
"internalConsoleOptions": "openOnSessionStart",
18+
"launchBrowser": {
19+
"enabled": true,
20+
"args": "${auto-detect-url}",
21+
"windows": {
22+
"command": "cmd.exe",
23+
"args": "/C start ${auto-detect-url}"
24+
},
25+
"osx": {
26+
"command": "open"
27+
},
28+
"linux": {
29+
"command": "xdg-open"
30+
}
31+
},
32+
"env": {
33+
"ASPNETCORE_ENVIRONMENT": "Development"
34+
},
35+
"sourceFileMap": {
36+
"/Views": "${workspaceRoot}/Views"
37+
}
38+
},
39+
{
40+
"name": ".NET Core Attach",
41+
"type": "coreclr",
42+
"request": "attach",
43+
"processId": "${command:pickProcess}"
44+
}
45+
]
46+
}

‎.vscode/tasks.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "dotnet",
4+
"isShellCommand": true,
5+
"args": [],
6+
"tasks": [
7+
{
8+
"taskName": "build",
9+
"args": [
10+
"${workspaceRoot}/src/NetCoreStack.Hisar.WebCli.Tools/NetCoreStack.Hisar.WebCli.Tools.csproj"
11+
],
12+
"isBuildCommand": true,
13+
"problemMatcher": "$msCompile"
14+
}
15+
]
16+
}

‎src/NetCoreStack.Hisar.WebCli.Tools/Controllers/PageController.cs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ public IActionResult GetFile([FromQuery]string fullname)
8181
return BadRequest($"{nameof(fullname)} not speficied!");
8282
}
8383

84-
fullname = PathUtility.NormalizeToOSPath(fullname, true);
84+
if(fullname.StartsWith("/"))
85+
{
86+
fullname = fullname.Substring(1);
87+
}
88+
else
89+
{
90+
fullname = PathUtility.NormalizeToOSPath(fullname, true);
91+
}
92+
8593
var cliEnvironment = HttpContext.RequestServices.GetService<CliEnvironment>();
8694
var path = Path.Combine(cliEnvironment.MainAppDirectoryWebRoot, fullname);
8795
if (System.IO.File.Exists(path))

‎src/NetCoreStack.Hisar.WebCli.Tools/Core/PathUtility.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public static class PathUtility
1414

1515
public static string NormalizeToWebPath(string filter)
1616
{
17+
// OS forward slash check.
18+
if(filter.StartsWith("/"))
19+
{
20+
return filter;
21+
}
22+
1723
if (!filter.StartsWith("\\"))
1824
{
1925
filter = "\\" + filter;

‎src/NetCoreStack.Hisar.WebCli.Tools/Properties/launchSettings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"Hisar.WebCli": {
2020
"commandName": "Project",
21-
"commandLineArgs": "--build ..\\..\\test\\Hisar.Component.Guideline",
21+
"commandLineArgs": "--appdir ..\\..\\test\\Hosting",
2222
"launchBrowser": true,
2323
"environmentVariables": {
2424
"ASPNETCORE_ENVIRONMENT": "Development"

0 commit comments

Comments
 (0)