-
Notifications
You must be signed in to change notification settings - Fork 10
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
opt-in nbOutDir and nbBaseDir #53
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this says
toAbsoluteDir
but it should actually be atoAbsoluteFile
. Should we use toAbsolute with nbHomeDir as base?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, good catch should indeed be File and not Dir 😄
Not really sure exactly how you intend to use
toAbsolute
here. Add it to the existing code or replace the existing code with it? It has a check that if the file-path is already absolute it will ignore the the base.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure either how to use it but there is not a
toAbsoluteFile
available right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, just assumed it did exist... Yes then we have to use it or
AbsoluteFile(file)
which it uses internally. That is if we know thatnbDoc.filename
is a absolute path to begin with...If
nbDoc.filename
is absolute (currently the case) it doesn't matter whatbase
is because it won't be used. If it on the other hand is a relative file then we'd want it to return its actual path in thenimibSrcDir
to be able to give the correct relative path later for saving the file innbHomeDir
. This is why we neednimibSrcDir
to begin with. So it depends on what the relative path is relative to I guess. But I don't think usingnbHomeDir
asbase
will work in any of the cases.I think what would work best as
base
in this case isnimibSrcDir
as one will be able to use it in the future to redefinerelPath
to use it instead ofnbHomeDir
. This was the way we did it in the early versions of getting-started as well, setting paths relative tonbSrcDir
: https://github.com/SciNim/getting-started/blob/a15d840fda541730fe9c513cbefeb1ca04fedce3/nbPostInit.nim#L2There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok think I've got this sorted now. We split it into two scenarios:
nbDoc.filename.isAbsolute
: We calculate the relative path fromnimibSrcDir
isRelative
: we do nothing, we trust the user has already set it to the appropriate relative path.How does this sound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good! 🚀