Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot test pwd against sysdir paths

    I am trying to create an assertion (using assert, if, `=cond()', or other) that tests whether the current directory is one of the sysdir directories. This seems simple and straightforward, but I cannot get it to work. As far as I know, the present working directory is only available in the system variable c(pwd) and the PERSONAL directory, for instance, is found in either the system variable c(sysdir_personal) or with the macro function `:sysdir PERSONAL'. Below are examples of what I have tried. As you can see, I've tried several levels of quoting with the various permutations. What am I missing
    Click image for larger version

Name:	pwd_vs_sysdir.png
Views:	1
Size:	136.8 KB
ID:	1669043
    Last edited by Matthew Hall; 13 Jun 2022, 12:02. Reason: fixed attachment again

  • #2
    I figured it out. Because the sysdir paths are stored and displayed with a trailing forward slash (on non-Windows systems, at least) and c(pwd) is not, the c(dirsep) system variable must be combined with c(pwd) for the assertion statement:
    Click image for larger version

Name:	pwd_dirsep_vs_sysdir_personal.png
Views:	1
Size:	69.1 KB
ID:	1669045

    Last edited by Matthew Hall; 13 Jun 2022, 12:15.

    Comment

    Working...
    X