Check if (!FILE) do this...
-
Im trying to just check if a text file exists, read the text....if no file exists, create an empty text file.
If I was doing this correctly the file should be created upon compiling (f5) correct?// Search All Files reg rootFolder = FileSystem.getFolder(FileSystem.Desktop); reg allFiles = FileSystem.findFiles(rootFolder, "*.wav", true); const appDataFolder = FileSystem.getFolder(FileSystem.AppData); const fileData = appDataFolder.getChildFile("LastUserSelectedFolder.txt"); const LastSelectedLocation = "Test this"; Console.print(fileData.loadAsString()); if (fileData) { rootFolder = fileData.loadAsString(); Console.print("File Is Here: " + rootFolder); } else { Console.print("Nothing Is Here"); fileData.writeString(""); } -
@Chazrox
I am not at my computer but I think there is a function called.isFile()which you should use in your if-statement. -
Yep there's a
File.isFile()andFile.isDirectory()for foldershttps://docs.hise.audio/scripting/scripting-api/file/index.html
-
@Oli-Ullmann @iamlamprey I promise you guys I was looking for this. hahaha. Thank You

That was it...Thank you guys!
-
C Chazrox has marked this topic as solved