-
Notifications
You must be signed in to change notification settings - Fork 757
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
Classlib: Recorder: Create user's recording directory if it doesn't exist #3788
Classlib: Recorder: Create user's recording directory if it doesn't exist #3788
Conversation
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.
Please update the documentation.
Also is this postf really necessary? I am generally wary of noise like this; it always seems to me that it's a bad way of making up for the fact that the behavior is somehow not predictable. I'd rather have clearer documentation, or more sensible design, than functions randomly informing me they've taken unexpected actions on my behalf. Just a thought.
I hadn't updated the documentation because the documentation didn't mention automatically creating any directories (so, at least, I didn't take accurate documentation and render it inaccurate). But, point taken, and done.
No, it isn't. My initial thought was that I didn't write the In general, I guess, for default locations like this, SC should just create them silently. Users will expect this to "just work." |
path = if(path.isNil) { this.makePath } { path.standardizePath }; | ||
dir = path.dirname; |
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.
in the future (or now if you like), it would be good to refactor this into String
. For so long, we have had no simple method that would just simply guarantee that a path exists and is well formatted. Maybe this could even be done in standardizePath
?
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.
For so long, we have had no simple method that would just simply guarantee that a path exists and is well formatted.
What do you mean? Doesn't File.exists
accomplish this? Also, that is definitely outside the scope of this PR.
Thanks! |
Recorder class should mkdir the user's chosen location in all cases
Yesterday, I gave some code that looks like this to a classroom full of students:
When I ran it in the classroom, the server complained that it couldn't open the output file.
Then I found out why:
Recorder:makePath
.makePath
is called only if you don't specify a path.Therefore, if the user wants to override the default filename but not the recording location, then the user has a gotcha -- "every other time I tried to record, there was no problem, but when I do it for the first time on a particular system in this way, it fails."
A reasonable solution is to ensure that the path exists in every case.