API's / File system /
Filesystem API
The API for the manipulation of files and folders adhers to the account the user is presently standing in.
You can dynamically find out where you are by checking the value of the variable
xin.pass.
The prefix is always
desktop/xin/xin.pass to find the directory that you are standing in.
Ex:-
xin.check_file("desktop/xin/"+xin.pass+"/test.txt","alert");
Callback functions (they expect a callback)
xin.
check_folder("path_to_folder","callback");
/* We check if the folder exists, and the callback function recieves "true" as a string value, if so */
»
Ex:- Does the folder »programs« exist?
xin.
check_file("path_to_file","callback");
/* We check if the file exists, and the callback function recieves "true" as a string value, if so */
»
Ex:- Does the file »programs/basics.xml« exist?
xin.
open_file("path_to_file","callback");
/* We open the file, and the callback function recieves the file content as a string value. */
»
Ex:- Open the file »programs/basics.xml«.
xin.xml.
load(xml_formatted_string);
/* This loads a string from the above function as XML. */
»
Ex:- Loads the file »programs/basics.xml« and displays the firstChild nodeName, and it does this crossdomain.
xin.
getfiles("path_to_folder","callback");
/* We retrieve all files in the folder as an array, received by the callback function. */
»
Ex:- See it in action.
xin.
getfolders("path_to_folder","callback");
/* We retrieve all folders in the folder as an array, received by the callback function. */
»
Ex:- See it in action.
Send functions (end with "xin.send(null,null,1);" to send)
xin.
copy_file("path_to_file","new_path_to_file");
/* Copies the file to the new location - needs full paths for both arguments. */
xin.
move_file("path_to_file","new_path_to_file");
/* Moves the file to the new location - needs full paths for both arguments. */
xin.
delete_file("path_to_file");
/* Deletes the file. */
xin.
copy_folder("path_to_folder","new_path_to_folder");
/* Copies the folder to the new location - needs full paths for both arguments. */
xin.
move_folder("path_to_folder","new_path_to_folder");
/* Moves the folder to the new location - needs full paths for both arguments. */
xin.
delete_folder("path_to_folder");
/* Deletes the folder. */
xin.
create_file("path_to_file");
/* Creates a file. */
xin.
create_folder("path_to_folder");
/* Creates a folder. */
Form functions (sent using dynamic form creation)
xin.
save_file("path_to_file","string");
/* Saves to file. */
xin.
append_file("path_to_file","string");
/* Appends to file. */