-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
loadStrings String Addition/Concatenation in Filepath #839
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
Comments
thanks for reporting! i'm not able to reproduce this, for me it is working, see https://editor.p5js.org/cassie/sketches/tk22ndoWs |
Hi @catarak! That was working for me as well. My problem came with adding strings together to make a filepath. Modifying your code would be:
|
This is the same underlying issue as #813 I believe, that you can't refer to local files properly. #771 #674 also seem at least partially related. All of these cases are referring to local files in the code that aren't being served up correctly. For example, in @catarak 's sketch above the file at |
ahh sorry! did not read closely enough 😸 and @meiamsome, yes, you're right. that url should return the text content like it does for images. |
Thanks @meiamsome for linking the other issues. The definition of "When the file names are generated programmatically, rather than just a string inline, it loads the files in a different way." in 674 would be a good way to describe this. Good to know I'm not crazy and that the example code "should" work. Thanks for the help everyone! |
For anyone looking to work on this, I believe the issue is in this function: p5.js-web-editor/server/controllers/project.controller.js Lines 151 to 182 in e75c98b
Specifically, it does not account for the case where @Sunomikey Yes, I can see how this behaviour can be confusing! |
Uh oh!
There was an error while loading. Please reload this page.
Nature of issue?
Details about the bug:
loadStrings() won't load anything past a direct file path.
What I can do:
loadStrings('test.txt')
OR
x = 'testFolder/test.txt';
loadStrings(x);
What I can't do:
ext = '.txt';
loadStrings('test'+ext');
OR
i = "1";
loadStrings('test'+i+'.txt');
2:
It won't ever leave the preload as it can't find the file. Is there a variable type it's looking for?
The text was updated successfully, but these errors were encountered: