Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend check-location to also compare basenames #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkoser
Copy link

@jkoser jkoser commented Oct 13, 2016

The previous version of check-location examined the current directory (as
a proxy for the directory in which the file calling check-location
appears) to check if it is of the form /pdp-/setNN but did not check
the supplied base file name. This version uses the actual path to the
calling file and additionally checks that the basename of the calling file
matches the file name supplied to check-location.

In order to obtain the path to the calling file, check-location is now a
macro that captures the file's path and expands into a call to the function
check-location-actual.

The previous version of check-location examined the current directory (as
a proxy for the directory in which the file calling check-location
appears) to check if it is of the form */pdp-*/setNN but did not check
the supplied base file name.  This version uses the actual path to the
calling file and additionally checks that the basename of the calling file
matches the file name supplied to check-location.

In order to obtain the path to the calling file, check-location is now a
macro that captures the file's path and expands into a call to the function
check-location-actual.
stx)]
[else
(raise-syntax-error #f
"found a use of `check-location' that is not at the top level"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to say something more like "in an unexpected location"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is true, that message would not offer any guidance on how to fix the problem.

(define set-folder (path->string (last path-elements)))
(define pdp-folder (path->string (list-ref path-elements (- path-len 2))))
[(>= path-len 3)
(define actual-file-name (path->string (last path-elements)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider (list-ref path-elements (- path-len 1)) for symmetry with the others instead of (last path-elements).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants