File.toString(int formatType)
-
@ulrik I seem to remember a while back we discovered a bug with the constants not returning the correct values - @Christoph-Hart
Each constant just returns a number
0, 1, 2, etc.
so for Filename I guess you would use3
. -
@d-healey ahh, yes you’re right, I remember now, thank you David!
-
Just want to give this a bump because these constants still don't work.
In fact none of them work now but I thought some of them did previously...
-
@d-healey Playing with them right now with files downloaded from a server. Here's what I'm seeing
.toString(0) = full file path
.toString(1) = filename (no extension)Is that different than what you're looking for?
-
@dustbro said in File.toString(int formatType):
Is that different than what you're looking for?
Try to print
.toString(File.NoExtension);
and you will get an undefined error. -
@d-healey said in File.toString(int formatType):
.toString(File.NoExtension)
I don't think you can use anything except an integer for this function.
The integer is passed to the .toString function switch case.
-
@dustbro Exactly but those constants should provide that integer so we don't have to use magic numbers
-
@d-healey Do any of the constants work? or are they all broken?
-
@dustbro said in File.toString(int formatType):
@d-healey Do any of the constants work? or are they all broken?
These File ones seem to all be broken, but I don't think that's always been the case.
-
@d-healey said in File.toString(int formatType):
@dustbro said in File.toString(int formatType):
@d-healey Do any of the constants work? or are they all broken?
These File ones seem to all be broken, but I don't think that's always been the case.
..its always been the case for me.
-
@d-healey @dustbro @Lindon Since the enum is part of the class
ScriptFile
, it is the reference of the file itself that you have to take for using the enum names, not theFile
API:const var myFile = FileSystem.getFolder(FileSystem.Desktop).getChildFile("myFile.txt"); Console.print(myFile.toString(myFile.NoExtension));
It is the same when you use, let's say a simple gain, it's the reference of the effect "myGain" you use to access the different parameters.
For instancemyGain.Balance
, notSynth.Balance
I know the location in
FileSystem
for instance are accessed throughFileSystem.SpecialLocation
,
but in this case, you use the API, not a reference of it that you have created (well, at least if I explain correctly :) ) -
@ustk Oh that's right! Mystery solved, thanks :)