Table of Contents
The Input/Output section of the library elements contains many additional functions available in Soley Studio that are not part of the original GrGen in-built functions.
Input/output operations are available for project paths and for files. You can call, create, write on, and delete external files using these functions.
Find an example of how to use these functions here.
Library elements for Input/Output actions
There are following helper library elements available for files and projects:
|IO_combineIntoPath||combines two strings into a full path and returns it|
|IO_getProjectFullPath||returns a full path to a file or a folder relative to the project.|
|IO_getProjectPath||returns a full path to the project’s folder|
For files (see this article for an example):
|IO_appendTextToFile||This procedure opens a file given a specified path, appends the text at the end of it and closes it. If the file does not exist, then it creates a new one.|
|IO_closeFile||This procedure closes a file that was opened before.|
|IO_deleteFile||This function deletes a file by the specified path.|
|IO_fileExists||Returns boolean true if a file exists by the given path. Else returns false.|
|IO_openFile||This function opens a file and returns it as an object. If the file does not exist, it will create a new one.|
|IO_readFileLines||This function opens a file, reads its content, closes the file and returns the content as an array of strings (a string for each line)|
|IO_readFileText||This function opens a file, reads its content, closes the file and returns the whole content as a single string|
|IO_readGraphFromFile||This function opens a file, reads its content, closes the file and returns the content as a graph.|
|IO_writeCurrentGraphToFile||This function opens a file, writes the current host graph to it and closes it. If the file already exists then it will be overwritten.|
|IO_writeFile||This procedure writes text to an open file. In comparison to IO_writeTextToFile, it requires the opening of the file before, and its closing after.|
|IO_writeGraphToFile||This function opens a file, writes the graph to it and closes it. If the file already exists it will be overwritten.|
|IO_writeLineFile||This procedure writes a line to a file and appends a newline at the end. It is similar to IO_writeFile, only the text is written on the same line as the existing text but on a new line.|
|IO_writeTextToFile||This procedure opens a file given a specified path, writes the text to it and closes it. If the file does not exist, it creates a new one. If it does, it overwrites it.|
If these functions do not fit your needs, you can have a look at the Global Function section of the Soley Help Center.