How to access files in a plugin's subfolder using FileIO?
The only way I've been able to do it is by settings source
to the full file path, including C:/Users/xxxx
. There has to be an easier way? I've tried subfolder/file
, /subfolder/file
, ./subfolder/file
, and filePath + /subfolder/file
all to no avail
Comments
I use filePath like this:
function showDocu()
{
filo.source = filePath + "/TabRing.html";
tout = filo.read();
if (tout == "") tout = "Documentation file not found.";
popInfo.text = tout;
tout = "";
infoWin.visible = true;
}
with: FileIO { id: filo }
I haven't set its value anywhere in the plugin but it points to the plugin's root folder.
In reply to I use filePath like this:… by yonah_ag
interesting, that seems to work fine but only outside of defining it in the object itself. thanks!
In reply to interesting, that seems to… by XiaoMigros
I'm placing the correct file paths in
Component.onCompleted
handlers nowIn reply to I'm placing the correct file… by XiaoMigros
..which doesnt work :(
In reply to I'm placing the correct file… by XiaoMigros
I have not come across Component
In reply to interesting, that seems to… by XiaoMigros
Not sure what you mean.
My definition is after plugin global properties:
// Score Map
property var mIX : [] // Map index
property var mMez : []
property var mTick : []
property var mStr : []
property var mFret : []
property var mFace : [] // Face value length
property var mMIDI : [] // MIDI note value for 2nds detection
property var mTup : [] // Tuplet factor or 0:Not a tuplet
property var mTie : [] // 0:No tie, 1:Tie forward, -1:Tie back
property var mVox : [] // Voice 0-3 within each Part
property var mPlay : [] // Play flag: =Play, =Silent
property var mOnT : [] // Ontime‰
property var mLen : [] // Length‰
property var mOnTk : [] // Ontime in ticks
property var mLnTk : [] // Length in ticks
property var mDoll : [] // $ string codes
property var mArt : [] // Articulations
// File Handle
FileIO { id: filo }
onRun:
{
checkTAB();
}
In reply to Not sure what you mean. My… by yonah_ag
yeah exactly, you have to define it later in the process and not with objects/global properties, namely during a scripting instance like onrun
In reply to yeah exactly, you have to… by XiaoMigros
My filo definition is near the top, right after the global objects and properties. It is not inside the onRun at all. That was just in the picture for some context.
In reply to Mine filo definition is near… by yonah_ag
yes, but the part where you set the source is somewhere else
I don't know if you still need a solution, but this is how I do:
This will look for a file
somefile.json
in the plugin's folder.In reply to I don't know if you still… by parkingb
I don't for now, but I'll keep it in mind if I need it for the future. Thanks!