(require 'cl-lib)

(defconst env--dirs-to-add
  '(
    "./trodevel"
    "${ProgramFiles(x86)}/Microsoft SDKs/Speech/v11.0/Include"
    "${ProgramFiles}/Microsoft SDKs/Speech/v11.0/Include"
    )
  )

(defun env--update-include-path (ThisFileDirectory)
  (when (and
    (fboundp 'yekneb--init-include-path)
    (fboundp 'yekneb--add-dirs-to-include-path-from-file)
    (fboundp 'yekneb--add-dir-to-include-path)
    (fboundp 'yekneb--write-include-path-to-file)
    )
    (let ((include-list (expand-file-name "INCLUDE.list" ThisFileDirectory)))
      (yekneb--init-include-path)
      (if (file-exists-p include-list)
          (yekneb--add-dirs-to-include-path-from-file include-list nil t)
        (let (
          (dirs env--dirs-to-add)
          )
          (mapc
           (lambda (dir)
             (if (string= (substring dir 0 2) "./")
                 (yekneb--add-dir-to-include-path (expand-file-name dir ThisFileDirectory) nil t)
               (yekneb--add-dir-to-include-path (substitute-in-file-name dir) nil t)
               )
             )
           dirs
           )
          (yekneb--write-include-path-to-file include-list t)
          )
        )
      )
    )
  )

(let (
  (ThisFile nil)
  (ThisFileDirectory nil)
  (WorkspaceRoot nil)
  (SetWorkspaceVariables_el nil)
  )
  (when (not (null load-file-name))
    (setq ThisFile load-file-name)
    (setq ThisFileDirectory (file-name-directory (expand-file-name ThisFile)))
    (env--update-include-path ThisFileDirectory)
    )
  )
