loadStrings wants always a data folder?
ff6347 opened this issue · 6 comments
When I try to load a file like this:
msgA = b.loadStrings("~/Desktop/myfile.txt");
I get this error msg:
Which is wired. Happens with the latest version on master (realted to #300 ???)
Yes, it always assumes a file name of a file in the data folder or a file object.
So you could do:
var myFile = file("~/Desktop/myfile.txt");
var myString = loadStrings(myFile);
Should we allow complete file paths as well? I think the code for detecting a complete file path vs. a data folder path is already in the file()
function, so it would be no problem to implement.
Not sure. For me it is wired to have the data folder due to the fact that Basil is portable now. I would vote for properly resolving relative paths starting with './path/to/…'
and 'path/to'
using
File($.fileName).parent +"/" + path
. It could also have a quick File(path).exists === true
check and complain when it does not.
Not sure. For me it is wired to have the data folder due to the fact that Basil is portable now.
basil being portable and the data folder are not really connected though, as the data folder relates to the InDesign document, not the script file or the basil file.
I would vote for properly resolving relative paths starting with './path/to/…' and 'path/to' using
File($.fileName).parent +"/" + path. It could also have a quick File(path).exists === true check and complain when it does not.
Directly within the loadStrings()
function or in the file()
function?
Wherever a string has to point to a file
Yes, I guess that makes sense. So I think we should implement all this in the file()
function itself and then have the loadStrings()
function and such as some wrapper for the files()
function.