summaryrefslogtreecommitdiff
path: root/app-shells/pwsh/files/pwsh-7.3.3-copy-ref.fsx
blob: 127d6eb9444bdc52d7ed8af862402cce917e2b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 1999-2024 Gentoo Authors
// Distributed under the terms of the GNU General Public License v2

open System.IO
open System.Runtime.InteropServices

let args = fsi.CommandLineArgs |> Array.tail

let wantedDirectory = System.IO.Path.GetFullPath args.[0]

printfn $" * Wanted directory: {wantedDirectory}"

System.IO.Directory.CreateDirectory wantedDirectory

let runtimeDirectory = RuntimeEnvironment.GetRuntimeDirectory()

printfn $" * Runtime directory: {runtimeDirectory}"

let runtimeFiles =
    System.IO.Directory.GetFiles runtimeDirectory
    |> Array.filter (fun s -> s.EndsWith ".dll")
    |> Array.sort

printfn $" * Copying {runtimeFiles.Length} files into {wantedDirectory}"

for runtime_file in runtimeFiles do
    let runtimeFileName = System.IO.Path.GetFileName runtime_file
    let wantedRuntimeFile = System.IO.Path.Join(wantedDirectory, runtimeFileName)

    FileInfo(runtime_file).CopyTo(wantedRuntimeFile, true) |> ignore