Skip to content

#cd compiler directive is ignored when #load-ing the script #1392

@matthid

Description

@matthid

When using #load preprocessor directives like #cd are ignored.

Repro steps

test.fsx

#cd "g"
#cd __SOURCE_FILE__
#load "other.fsx"
#cd __SOURCE_DIRECTORY__

g/test.fsx/other.fsx

printfn "other.fsx"
  1. fsi
  2. #load "test.fsx"

Expected behavior

other.fsx

Actual behavior

test.fsx(3,1): error FS0079: Could not load file 'C:\PROJ\visualfsharp.issues\loadWithCd\other.fsx' because it does not exist or is inaccessible

Known workarounds

Currently none.

Related information

Executing the file directly

fsi test.fsx

yields the expected output:

other.fsx

I used this originally because I cannot write something like

#load ("g/" + __SOURCE_FILE__ + "/other.fsx")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions