Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsdk,Fsdk.Tests: enable Misc/Tsv tests on legacy #36

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Fsdk.Tests/Fsdk.Tests-legacy.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<ItemGroup>
<Compile Include="FSharpUtil.fs" />
<Compile Include="AsyncExtensions.fs" />
<Compile Include="Tsv.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fsdk\Fsdk-legacy.fsproj" />
Expand Down
35 changes: 28 additions & 7 deletions Fsdk/Misc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,32 @@ module Misc =
#if LEGACY_FRAMEWORK
// this below is crazy but is to avoid # char being ignored in Uri.LocalPath property, see https://stackoverflow.com/a/41203269
let private currentExeUri =
Uri(Uri.EscapeUriString(Assembly.GetEntryAssembly().CodeBase))
let entryAssembly = Assembly.GetEntryAssembly()

if isNull entryAssembly then
None
else
Uri(Uri.EscapeUriString(entryAssembly.CodeBase)) |> Some

let private currentExe =
FileInfo(
sprintf
"%s%s"
(Uri.UnescapeDataString(currentExeUri.PathAndQuery))
(Uri.UnescapeDataString(currentExeUri.Fragment))
)
match currentExeUri with
| None -> None
| Some currentExeUri ->
FileInfo(
sprintf
"%s%s"
(Uri.UnescapeDataString(currentExeUri.PathAndQuery))
(Uri.UnescapeDataString(currentExeUri.Fragment))
)
|> Some

let rec private FsxOnlyArgumentsInternalFsx(args: list<string>) =
let currentExe =
if currentExe.IsNone then
failwith "Could not get EntryAssembly"
else
currentExe.Value

match args with
| [] -> []
| head :: tail ->
Expand Down Expand Up @@ -96,6 +111,12 @@ module Misc =
// likely running a fsxc-ed assembly from an .fsx script (so 'dotnet someFile.fsx.dll someArg1' instead of 'dotnet fsi someFile.fsx someArg1')
List.skip 1 cmdLineArgs
#else
let currentExe =
if currentExe.IsNone then
failwith "Could not get EntryAssembly"
else
currentExe.Value

let isFsi =
String.Equals(
currentExe.Name,
Expand Down
Loading