Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Search standard dirs for fsc on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rneatherway committed May 8, 2015
1 parent 6b7ddb1 commit 445d7fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
21 changes: 14 additions & 7 deletions emacs/fsharp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@

(defvar fsharp-compile-command
(or (executable-find "fsharpc")
(executable-find "fsc"))
(fsharp-mode--executable-find "fsc"))
"The program used to compile F# source files.")

(defvar fsharp-build-command
(or (executable-find "xbuild")
(executable-find "msbuild"))
"The command used to build F# projects and solutions.")

(defvar fsharp-compiler nil
"The command used to compile an individual F# buffer.
This will be set to a sane default, depending the type of file
and whether it is in a project directory.")
(make-variable-buffer-local 'fsharp-compiler)

;;; ----------------------------------------------------------------------------

(defvar fsharp-shell-active nil
Expand Down Expand Up @@ -386,6 +380,19 @@ passed to `mono'."
'fsharp-run-executable-file-history)))
(start-process-shell-command cmd nil cmd)))

(defun fsharp-mode--executable-find (exe)
(if fsharp-ac-using-mono
(executable-find exe)
(let* ((programfiles (file-name-as-directory
(car (-drop-while 'not
(list (getenv "ProgramFiles(x86)")
(getenv "ProgramFiles")
"C:\\Program Files (x86)")))))
(searchdirs (--map (concat programfiles "Microsoft SDKs/F#/" it "/Framework/v4.0")
'("3.0" "3.1" "4.0")))
(exec-path (append searchdirs exec-path)))
(executable-find exe))))

;;; Project

(defun fsharp-mode/find-sln-or-fsproj (dir-or-file)
Expand Down
13 changes: 3 additions & 10 deletions emacs/inf-fsharp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
(require 'fsharp-mode-completion)
(with-no-warnings (require 'cl))

(declare-function fsharp-mode--executable-find "fsharp-mode.el" (exe))

;; User modifiable variables

;; Whether you want the output buffer to be diplayed when you send a phrase
Expand All @@ -38,16 +40,7 @@
(defvar inferior-fsharp-program
(if fsharp-ac-using-mono
"fsharpi --readline-"
(let* ((programfiles (file-name-as-directory
(car (-drop-while 'not
(list (getenv "ProgramFiles(x86)")
(getenv "ProgramFiles")
"C:\\Program Files (x86)")))))
(searchdirs (--map (concat programfiles it)
'("Microsoft SDKs/F#/3.1/Framework/v4.0"
"Microsoft SDKs/F#/3.0/Framework/v4.0")))
(exec-path (append searchdirs exec-path)))
(concat "\"" (executable-find "fsi.exe") "\"")))
(shell-quote-argument (fsharp-mode--executable-find "fsi.exe")))
"*Program name for invoking an inferior fsharp from Emacs.")

;; End of User modifiable variables
Expand Down

0 comments on commit 445d7fc

Please sign in to comment.