FileSystem - wheres "CreateFile"?
-
Are you sure? I think it should be possible.
-
@Lindon AFAIR the file is automatically created...
-
OK can either of you give me an example? I have this JSON:
const var p = { "id": "myID", "password": "something" };
how do I encode this in a file ?
- to be precise - in a file that currently does not exist...
-
@Lindon It's what David said
writeEncryptedObject
You just need a File object in HISE in which to store it. That doesn't mean the file already has to exist.
-
Try something like this:
const var p = { "id": "myID", "password": "something" }; local machineId = FileSystem.getSystemId(); local dir = FileSystem.getFolder(FileSystem.AppData); dir.getChildFile("license.dat").writeEncryptedObject(p, machineId);
-
@Lindon
Are you using Woocommerce REST API for customer login?
Which REST API method do you suggest for this (verifying purchases, license status...etc)? -
@Lunacy-Audio said in FileSystem - wheres "CreateFile"?:
const var p =
{
"id": "myID",
"password": "something"
};
local machineId = FileSystem.getSystemId();
local dir = FileSystem.getFolder(FileSystem.AppData);
dir.getChildFile("license.dat").writeEncryptedObject(p, machineId);OK thanks - now we are back at this AppData shenanigans, which I was hoping to avoid...
-
@Steve-Mohican said in FileSystem - wheres "CreateFile"?:
@Lindon
Are you using Woocommerce REST API for customer login?
Which REST API method do you suggest for this (verifying purchases, license status...etc)?No I am using a custom built api that checks users subscription levels and which plug-ins they have access to.
-
@Lindon I think appData was just an example, use a different folder if you want to.
-
@d-healey said in FileSystem - wheres "CreateFile"?:
@Lindon I think appData was just an example, use a different folder if you want to.
I didnt mean literally just "AppData" - its any folder in the file system - its a lot less friendly than the loadAsJSON, saveAsJSON, which puts the file in the {PROJECT FOLDER} when I'm in development and using HISE, and puts it in the projects own folder when its compiled...
Where as the File System insists upon using (for example) the AppData folder all the time, elsewhere I've asked why we cant have :
local dir = FileSystem.getFolder(FileSystem.ProjectFolder);
as clearly there's a mechanism at play that can resolve this in development and at run time...
-
@Lindon said in FileSystem - wheres "CreateFile"?:
local dir = FileSystem.getFolder(FileSystem.ProjectFolder);
And this folder is pointing to what in a compiled plugin?
-
@Christoph-Hart pointing to AppData
-
@Lindon I haven't had any issues using the AppData folder both for development in HISE and in the compiled plugin. It's actually nice because you don't have two sets of the same files. For example, in my code I create and store a custom settings file in the AppData folder, so when I'm developing in HISE it just writes to the same file as the compiled plugin, which is totally fine.
Is there a specific use-case you want for saving things to the Project Folder instead of the AppData folder?