Closed TracerDS closed 4 days ago
Genius
Are you aware of function fileGetContents
? You can just fileGetContents(fileOpen("file.txt"))
.
Are you aware of function
fileGetContents
? You can justfileGetContents(fileOpen("file.txt"))
.
Does fileGetContents
close the file automatically for you?
It also requires a file handle. It was either that or modify fileGetContents
Are you aware of function
fileGetContents
? You can justfileGetContents(fileOpen("file.txt"))
.Does
fileGetContents
close the file automatically for you? It also requires a file handle. It was either that or modifyfileGetContents
It doesn't no. So I'm fine with this change for quality of life. Perhaps fileGetContents could have something similar
Are you aware of function
fileGetContents
? You can justfileGetContents(fileOpen("file.txt"))
.Does
fileGetContents
close the file automatically for you? It also requires a file handle. It was either that or modifyfileGetContents
Oh, you're right, it doesn't. Okay then.
@TracerDS Make fileGetContents accept a string as argument, so it does the opening and closing of the file automatically. It can keep working with an open file handle as argument for backwards compatibility and certain use cases. This way, there is no need for a separate new function.
@TracerDS Make fileGetContents accept a string as argument, so it does the opening and closing of the file automatically. It can keep working with an open file handle as argument for backwards compatibility and certain use cases.
so, the same thing as fileRead
but for fileGetContents
?
@TracerDS Make fileGetContents accept a string as argument, so it does the opening and closing of the file automatically. It can keep working with an open file handle as argument for backwards compatibility and certain use cases.
so, the same thing as
fileRead
but forfileGetContents
?
I don't see any cons to that
So uhmmm, arent fileRead and fileGetContents the same now? Is fileRead necessary?
So uhmmm, arent fileRead and fileGetContents the same now? Is fileRead necessary?
One major difference at least is that fileGetContents requires files to be in meta.xml, and has the ability to validate them. But overall they are getting pretty close to each other
So uhmmm, arent fileRead and fileGetContents the same now? Is fileRead necessary?
One major difference at least is that fileGetContents requires files to be in meta.xml, and has the ability to validate them. But overall they are getting pretty close to each other
Only if the second argument is set to true.
I like fileRead but it's exactly the same as doing fileGetContents(path, false)
Can we have fileRead still?
I like fileRead but it's exactly the same as doing fileGetContents(path, false)
Can we have fileRead still?
There is no reason to remove it
I like fileRead but it's exactly the same as doing fileGetContents(path, false) Can we have fileRead still?
There is no reason to remove it
Sorry, I had a brain fart. Forgot fileRead already existed. This is nice QoL feature.
PR LGTM then :shipit:
Currently, to read a file you have to have a boilerplate code for opening and closing a file:
This PR will allow you to read file from path without having to define this boilerplate: