Button for "Change Sample Folder Location" out settings?
-
It seems this would be the easiest way to open the currently selected sample folder for the plugin. Is it possible to do?
-
Is it possible to do?
Yes. Here's how I'm doing it for expansions. https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/includes/Expansions.js#L230
-
Awesome, thanks!
So this part looks like what Im looking for, and it compiles correctly, but how do I add a button to test? I did the obvious dumb mistake and tried to put an inline function within another.
inline function createLinkFile(expansionName, target) { local linkFile; //Find User OS switch (Engine.getOS()) { //Determine AppData File to locate case "OSX": linkFile = "LinkOSX"; break; case "LINUX": linkFile = "LinkLinux"; break; case "WIN": linkFile = "LinkWindows"; break; } //Locate AppData folder local appData = FileSystem.getFolder(FileSystem.AppData); //Here is where I would want to open the folder, yes? local f = appData.getChildFile(linkFile); if (isDefined(f) && isDefined(target) && target.isDirectory()) f.writeString(target.toString(f.FullPath)); }
-
I just re-read your post. I misunderstood what you were trying to do.
This should do it
HiseSnippet 835.3ocsU81SSCDF+tAEsSkHI9AngWP5RvkMEQSHFwswLKxfEKR7cjiqWYW35cMWuhtXHwOZ9d+x32.84ZKrBrfvRrYYoO+8987bO+d5HshxRSUZD18fIILD9wNASjlwcGS3RzfdH7xNCIoFl1qPUmIIjzTVHBiW3CVEX2EQ4O+9ccHBhjxlpBgNTworc4wbyTsi19ibgnOIjc.Oth2ar8.pR1UITY.dVvoEJgPOkbBaOh0sZNH7R6DxMJcfgXXofOcTgSBFq9prv+C4o7iELqPaT.jnB0nti4hvQWTqoHDdwQSq7EJp7m4LjGxuT+zNvSyM3MMhp8.bsaCRsuGPBWARKV.oUbBnZdhYpEKddjy.IbgDQfVcUnT3Kp1uvNcUfGRSyXxor9ZP3xH72rUq08f+ZrU8504RAWx7hxjTCWI8TxNYFiR11l.sR3SUwIJIjp08NiHxXMp+85t7HO+RIWPzUnnDgWHW68Vu9bAKXBLvD27DlouRDxz9UTFPhSDrzFa4BAB+r4hm1iEA3HzGxQCu0VylqlfVtlQgd6D+FvI45Z0lBsVe.6tm6V+bnDtnRgCq6EX0e0xpX0FMSs5yqktDg3XXfx+5EIjsJMf8TF19R+7Bs9408ttonnYZqLWBnZmkY6jt91BzWlEeLSWsMacDFEt570R2s4KZQaohiJ4.I2reBqTN+pIr38aNMhJ6qvaedPOhgXGPK0A9kvzFtEN3dry.Fdw3pqSOV5oFURtukWFH7CL4VWtbXtn4i3g1.JuIPe6x0.+HZ6IWJ7yS1lmNTEC4gnA03ZLIAJWKgbWFQKsy8ojyXCjizL3t1JitIQBnvpvLAwbUdscAVoA3x3JjIKgQlxMSptf6dP1acqj86JDWwYD2PGOaLVaFXDtl9efwxUjOwYmnHfRNEfK5z+Ky69v+ww+IUlgKOYHwn4v3gydYwAvWFnL3zkRl.RtCtlcTsPtkU11ABXxvbg+.OkFaakwkFaegQTLgpUGQKnf1kvOLWCfIY92bbgO9AxdsQ4zRHNmVMaghgwuinTa4+bf8L6XdwbDyKmiX1XNh4UyQLaNGw754Hl2bqwXY9uOynhKnCfhQ6jueBi2Ie0P9TH5uCTyaB.
-
@d-healey Got it, thank you!
-
@d-healey Is there a way you can use this and still change the sample folder location?
-
@trillbilly to let the user change the sample location (outside the settings) you'll have use the FileSystem API and
FileSystem.browseForDirectory
.You'll have to thank @d-healey again :) : https://www.youtube.com/watch?v=ddodaOOFXik
-
@trillbilly said in Button for "Change Sample Folder Location" out settings?:
@d-healey Is there a way you can use this and still change the sample folder location?
What do you mean exactly? My original answer give you a custom solution to changing the sample location, but I'm not sure if this is what you are asking...
-
@d-healey Yes, A button on UI that changes the sample folder location.
The first code you showed I thought was it but when you sent the 2nd one, I thought maybe I was looking at it wrong.
The 2nd Snippet you showed opens the folder location, but from what I understand, when you click the "Change Sample Folder" button in sttings within hise, it tells you something along the lines of "This can only be done in an exported plugin". So I assume it only shows the location and doesnt change the file path.
I think I'll have to follow your video @Matt_SF provided and start there.
-
@trillbilly when doing that from the settings in the exported plugin, it will open a browser asking to point to the *.ch1 files your plugin is using. Then it automatically update the 'LinkOS' file.
If you want to do this from outside of the settings panel, you'll have to script the same process yourself, using the File / FileSystem API.
-
@Matt_SF got it. So maybe the better question is can I customize the "button" within the settings panel for this? Possibly by using any image?
-
@trillbilly ah, for this you want to use global laf
-
@Matt_SF You can use local laf I think
-
@d-healey oh? Didn't know that