Minor problem with File API
-
const var appDataFolder = FileSystem.getFolder(FileSystem.Samples); const var presetsFolder = appDataFolder.getChildFile("ExpansionMetaData"); const var fileList = FileSystem.findFiles(presetsFolder, "*_expansion.json", true); Console.print(fileList[0].toString(fileList[0].Filename));
doesnt seem to work - it returns the full path every time.
this does work however:
const var appDataFolder = FileSystem.getFolder(FileSystem.Samples); const var presetsFolder = appDataFolder.getChildFile("ExpansionMetaData"); const var fileList = FileSystem.findFiles(presetsFolder, "*_expansion.json", true); Console.print(fileList[0].toString(fileList[0].NoExtension));
OnlyExtension also doesnt work...
-
You don't need to put
fileList[0].Filename
, you just put the string constant. So in your case it would beConsole.print(fileList[0].toString("Filename"));
-
@d-healey said in Minor problem with File API:
Console.print(fileList[0].toString("Filename"));
sure I can do that and it works(or more correctly - breaks) in exactly the same way:
it prints out this:
H:\Audio\Channel Robot\Hise_Work\Substrate\Samples\ExpansionMetaData\Substrate_expansion.json
when it should print out this:
Substrate_expansion.json
-
This post is deleted!
-
Ok I figured it out, your method was right Lindon. The constant is a member of the file object but Filename has not been implemented.
You can cheat it though since it's just an integer, use
3
.
Console.print(fileList[0].toString(3));
@Christoph-Hart Little fixes required: According to docs
File.Extension
should beFile.OnlyExtension
, andFile.Filename
is missing.
-
Yup, use the int. Works for me.