I have the following file located in a "New Folder" of Desktop:
// File location: "C:\Users\my_user_name\Desktop\New folder\AddOne.fs"
//
module internal AddOneModule
let AddOneFunction x = x + 1
I can access this file by using #load on the full path name using FSI F# Interactive.
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> #load "C:\Users\my_user_name\Desktop\New folder\AddOne.fs";;
//[Loading C:\Users\my_user_name\Desktop\New folder\AddOne.fs]
//namespace FSI_0002
// val AddOneFunction : x:int -> int
> open AddOneModule;;
> AddOneFunction 100;;
// val it : int = 101
How do I change the working directory so that I can access the file using relative path?
F# interactive:how to display/change current working directory
I tried something similar to the post above, but FSI still tries to find the file in the Temp folder:
(RESET FSI)
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System;;
> Environment.CurrentDirectory <- @"C:\Users\my_user_name\Desktop\New folder";;
//val it : unit = ()
> #load "AddOne.fs";;
// #load "AddOne.fs";;
// ^^^^^^^^^^^^^^^^^
//C:\Users\my_user_name\Desktop\New folder\stdin(3,1): error FS0078: Unable to find
//the file 'AddOne.fs' in any of
// C:\Users\my_user_name\AppData\Local\Temp
Thank you for your help.