Proper Written Documentation of API is needed besides Updates
-
Besides update and fixing bugs a good documentation and Examples is must needed.
For example :
FileSystem
>Browse
FileSystem.browse(var startFolder, bool forSaving, String wildcard, var callback)
Unable to figure out the arguments.
Same for other APIs e.g
File, FileSystem
Example and proper written doc is must needed.
-
@Tania-Ghosh how is this (already in the file system documentation) not what you need:?
FileSystem.browse(var startFolder, bool forSaving, String wildcard, var callback)
This will create a file browser from the OS that let's the user choose a file for loading or saving (in case of saving it will confirm a overwrite).
the startFolder parameter can be either a File object or one of the special location constants of the FileSystem API object. If you pass undefined it will choose a sensible default (most likely the most recent location).
the forSaving parameter decides whether the file is supposed to be overwritten or just read from.
the wildcard parameter is a file wildcard (like eg. *.txt for all text files) and can be used to filter the files being displayed. If the wildcard is an empty string, it will show all files.
the callback parameter is a function with one parameter that will be executed when a file has been chosen.
-
@Lindon Hmm.. But unable to figure out var callback and var startFolder
E.g
FileSystem.browseForDirectory(var startFolder, var callback) -
@Lindon I would like to Access C:\ from a Button...
How would I access it from interface?
Content.makeFrontInterface(500, 400); const var Button1 = Content.getComponent("Button1"); inline function onButton1Control(component, value) { }; Content.getComponent("Button1").setControlCallback(onButton1Control);
-
@Tania-Ghosh
so the documentation states:the startFolder parameter can be either a File object or one of the special location constants of the FileSystem API object.
So go look in the documentation for the File object, or go look at the documentation for the FileSystem, where you will find:
FileSystem.getFolder(var locationType)
You can use this method to access files from one of the given locations (take a look at the Special Locations above for a list of available folders).
..and it even links you to the special locations, where you find:
Special Locations
In order to access files, you will need to use the constants of the FileSystem object in order to go to special locations.Location Description
AudioFiles The audio file folder. In HISE it will be the repo folder, but in the compiled project it will be a sub folder in the appdata folder.Samples The sample folder as specified in the settings (or the subfolder of the HISE project during development).
AppData The app data directory. This is the main directory for your project which will house the configuration files and user presets.
UserHome The user home folder. Documents The user's Document folder.
Desktop The user's desktop folder.
Downloads The user's download folder.
-
@Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:
@Lindon I would like to Access C:\ from a Button...
How would I access it from interface?
Content.makeFrontInterface(500, 400); const var Button1 = Content.getComponent("Button1"); inline function onButton1Control(component, value) { }; Content.getComponent("Button1").setControlCallback(onButton1Control);
There is no such thing g'teed to be there as "C:" - so you're code will break on some users machines.. use one of the special locations.
-
@Lindon Then
C:\Users\Tania\AppData\Roaming\PluginsName
-
@Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:
@Lindon Hmm.. But unable to figure out var callback and var startFolder
E.g
FileSystem.browseForDirectory(var startFolder, var callback)if you dont know how to use the var callback - you should go read some javascript documentation about function calls.
-
@Tania-Ghosh said in Proper Written Documentation of API is needed besides Updates:
@Lindon Then
C:\Users\Tania\AppData\Roaming\PluginsName
Write. Some. Code.
simple console print statements that show you the values for the special locations on your machine...
..and read the documentation it clearly states:
AppData The app data directory. This is the main directory for your project which will house the configuration files and user presets.
-
so this:
FileSystem.browse(FileSystem.AppData, false, "*.txt", function(result) { // the parameter is a File object, so we just show it // in the OS' file browser. result.show(); });
Which by the way is taken almost entirely from the existing documentation...
-
Content.makeFrontInterface(500, 400); const var appDataFolder = FileSystem.getFolder(FileSystem.AppData); const var presetsFolder = appDataFolder.getChildFile("User Presets"); const var Button1 = Content.getComponent("Button1"); inline function onButton1Control(component, value) { FileSystem.browse(presetsFolderUser, false, "*.preset", function(file) }; Content.getComponent("Button1").setControlCallback(onButton1Control);
What I am doing wrong here?
-
@Tania-Ghosh The last parameter needs to be a function. A function looks like this
function (parameters) {}
Remember this is a parameter inside the
.browse
function call so you also need to put a closing parenthesis like you would for anything other function call.There are plenty of example of this kind of thing on the forum. Here for example: https://forum.hise.audio/topic/2807/new-api-server-and-filesystem?_=1618742189142
-
HiseSnippet 962.3ocsV0saaaCElxwpXVctXEXO.B9JkAOC4sztALLrj3XO3skTio1hdWAsDsMQnHEDoRpQQA1i7dC1NTTxhJwsK0.yW4yu76b347QsHWDSjRQNxo2K2lQPNeoazVtZyjMXJGM+BjySbuDKUjbeipy2lgkRRBxw4neUqvoWWT4u+9WNGyv7X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XSHNmeCvwZVoPWtXZIGriyTNFVdLZ+WDiBDfK
Not working
-
@Tania-Ghosh That's the same code in your last post. You haven't written the callback function properly and you haven't put the closing parenthesis on the
.browse
function call. Take a look at the examples in the link I posted. -
@d-healey Sorry but didn't understand...
-
Found from this post
var folder = FileSystem.getFolder(FileSystem.Expansions).getChildFile("UserPresets"); FileSystem.browse(folder, false, "", function() {});
-
@d-healey Ok Done... Prob Solved.
Thank you :)
-
@Lindon . Thank you man for nice Explanation. (y)
-
@Tania-Ghosh any time.