Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 934
Grzenio Avatar asked Jun 06 '12 15:06

Grzenio


People also ask

What grade do you need to bring up an F?

F Letter Grade is a 0.0 GPA or 65 or below% – GPA Calculator.

What happens if I get an F in a class?

Failed classes count toward your GPA, though some colleges do not count pass/fail classes in your GPA calculation. If you get an F, you still have to pay for the class without receiving any credit toward your degree. What's more, failed classes don't count toward graduation requirements either.

What does getting an F mean?

F - this is a failing grade.


2 Answers

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
like image 88
pad Avatar answered Oct 09 '22 20:10

pad


You could set the current working directory when running in FSI:

#if INTERACTIVE
System.IO.Directory.SetCurrentDirectory("<project_path>")
#endif
like image 20
Daniel Avatar answered Oct 09 '22 20:10

Daniel