Skip to content

Commit

Permalink
Merge pull request #16 from dawedawe/fix_preview_sdk
Browse files Browse the repository at this point in the history
Fix creation of fallback xml paths when using a preview sdk
  • Loading branch information
dawedawe authored Aug 22, 2024
2 parents e49fedc + f8c0d81 commit 8b4e0e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.0.4] - 2024-08-22

### Fixed

* Fixed support for non-FSharp.Core namespaces when using a preview SDK.

## [1.0.3] - 2024-08-20

### Fixed
Expand Down
14 changes: 11 additions & 3 deletions src/Fsih/Parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,17 @@ let toFallbackXmlPath (xmlPath: string) =
let sep = Path.DirectorySeparatorChar
let xmlPath = replaceLast xmlPath "shared" "packs"
let xmlPath = replaceLast xmlPath $".App{sep}" $".App.Ref{sep}"
let version = Regex.Match(xmlPath, @"\d+\.\d+\.\d+").Value
let release = version.Substring(0, version.LastIndexOf('.'))
let xmlPath = replaceLast xmlPath version $"{version}{sep}ref{sep}net{release}"
let splitted = xmlPath.Split(sep)
let fullVersion = splitted.[splitted.Length - 2]

let shortVersion =
fullVersion.Split(".")
|> Array.take 2
|> fun ns -> System.String.Join(".", ns)

let xmlPath =
replaceLast xmlPath fullVersion $"{fullVersion}{sep}ref{sep}net{shortVersion}"

xmlPath

let tryGetXmlDocument xmlPath =
Expand Down

0 comments on commit 8b4e0e1

Please sign in to comment.