How can I get F# Interactive window to use the same path as the project?

f#, f#-interactive

Solution

I think `__SOURCE_DIRECTORY__` identifier could help here.

You should use compiler directives to separate between using F# Interactive and compiling F# project.

#if INTERACTIVE
  let path = __SOURCE_DIRECTORY__ + some_relative_path
#else
  let path = another_relative_path
#endif

Problem

In my project I am opening a file with some relative path to the executable. I was trying to test my code in the F# Interractive window, but it seems to run from a completely different path. How can I change the path/ make it run from the same path as the project?

Original source