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

Improve error handling in Server:prepareForRecord #1580

Closed
bagong opened this issue Jun 29, 2015 · 9 comments
Closed

Improve error handling in Server:prepareForRecord #1580

bagong opened this issue Jun 29, 2015 · 9 comments
Assignees
Labels
Milestone

Comments

@bagong
Copy link
Contributor

bagong commented Jun 29, 2015

Windows 8.1, SC alpha1, VS build, 64 bit
Files via
s.prepareForRecord("C:\Users\name\Documents\SuperCollider\test\test.wav")
or
s.prepareForRecord("C:/Users/name/Documents/SuperCollider/test/test.wav")

can only be created, if all folders in a path already exist on the system. In any other case file-creation fails.

@bagong bagong added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. os: Windows labels Jun 29, 2015
@jamshark70
Copy link
Contributor

Why is this even a bug? I think it would be rather extraordinary to expect the server, or even the language, to create directories automatically.

Sorry, but I think this should just be closed.

@bagong
Copy link
Contributor Author

bagong commented Jun 30, 2015

Really, well you obviously have some technical insight, I am missing. I naively assume it should be possible to create any path you can write and you have write access to. If it's really absurd, please close. I am on the road.
However it is certainly counter intuitive and sc shouldn't tacitly write just nothing in that case.

@jamshark70
Copy link
Contributor

What I mean is: Standard behavior, in any programming language, when you try to open a file for writing and the location doesn't exist, is to fail to open the file. One rationale is that you wouldn't want typos to create spurious directories in the file system.

In Linux, scsynth posts an error in this case that the path couldn't be opened. To me, this is the expected behavior. If the error doesn't appear in Windows, that would be a bug.

@bagong
Copy link
Contributor Author

bagong commented Jun 30, 2015

Well, you get an error, when you run prepareForRecord as an individual command. But in a series of commands the message won't turn up and recording just writes nothing. But it's certainly not the type of bug I believed it to be...

@bagong
Copy link
Contributor Author

bagong commented Jun 30, 2015

Can you remove the tags for me. I am on a mobile.

@bagong bagong closed this as completed Jun 30, 2015
@jamshark70
Copy link
Contributor

I'll mark this as an enhancement for future (not 3.7). It's a legitimate problem that the language gives no sort of result to the user that the file-open failed. It can do so (see http://doc.sccode.org/Reference/Server-Command-Reference.html#/fail):

o = OSCFunc({ |msg| msg.postln }, '/fail', s.addr);
b = Buffer.alloc(s, 65536, 1);
b.write("~/doesntexist/nope.aiff".standardizePath, leaveOpen: true);
--> posts:
File '/home/dlm/doesntexist/nope.aiff' could not be opened: System error : No such file or directory.
[ /fail, /b_write, File '/home/dlm/doesntexist/nope.aiff' could not be opened: System error : No such file or directory.
, 0 ]

b.close;
b.free;

prepareForRecord could detect this and do something... throw an error that the user could catch? (Tricky b/c this is asynchronous.) Also, /b_write sends /done back to the client if successful, so we could use that to determine success and clean up OSCFuncs.

@jamshark70 jamshark70 reopened this Jul 1, 2015
@jamshark70 jamshark70 added enhancement comp: class library SC class library and removed bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. os: Windows labels Jul 1, 2015
@jamshark70 jamshark70 added this to the 3.8 milestone Jul 1, 2015
@jamshark70 jamshark70 self-assigned this Jul 1, 2015
@jamshark70 jamshark70 changed the title Windows recording: specifying path for prepareForRecord only works with preexistant folders. New folders are not created Improve error handling in Server:prepareForRecord Jul 1, 2015
@jamshark70
Copy link
Contributor

Shouldn't be done until #1581 is fixed.

@telephon
Copy link
Member

telephon commented Jul 1, 2015

I'll add it in #1547, which will go into 3.8

@bagong
Copy link
Contributor Author

bagong commented Mar 24, 2016

Addressed in #1655

@bagong bagong closed this as completed Mar 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants