Files Library (ssk.files.*)
WARNING - You should consider this an advanced library and use it with caution and clarity of purpose. While I have taken steps to reduce the likelihood of you deleting your hard drive, I won't say it is impossible if you try hard enough.
~ The Roaming Gamer
This library gives you the ability to fully explore, modify, copy, move, and remove folders and files in the current OS file-system. The only limits are the permissions the current OS has granted your application.
This library has been tested on these operating systems:
- Android (multiple versions)
- iOS (multiple versions)
- Windows (7,8,10) - This includes in the simulator and Desktop builds.
- OS X (multiple versions) - This includes in the simulator and Desktop builds.
Documents Folder (ssk.files.documents.*)
getRoot()- Returns a string containing the full OS-path to thesystem.DocumentsDirectoryfolder.getPath( path )- This returns a string catenatingpathto the full OS-path to thesystem.DocumentsDirectoryfolder.
Resource Folder (ssk.files.resource.*)
getRoot()- Returns a string containing the full OS-path to thesystem.ResourceDirectoryfolder.getPath( path )- This returns a string catenatingpathto the full OS-path to thesystem.ResourceDirectoryfolder.
Temporary Folder (ssk.files.temporary.*)
getRoot()- Returns a string containing the full OS-path to thesystem.TemporaryDirectoryfolder.getPath( path )- This returns a string catenatingpathto the full OS-path to thesystem.TemporaryDirectoryfolder.
Desktop (OS X and Windows) (ssk.files.desktop.*)
getDesktopRoot()- Returns a string containing the full OS-path to the user's Desktop.getDesktopPath( path )- Catenatespathto a string containing the full OS-path to the user's Desktop.getMyDocumentsRoot()- Returns a string containing the full OS-path to the user's Documents Folder.getMyDocumentsPath( path )- Catenatespathto a string containing the full OS-path to the user's Documents Folder.getDrivePath( path )- Returns the OS-specific drive path for any named drivepath.explore( path )- Openspathfolder using the current OSes file explorer utility.
Utilities (ssk.files.util.*)
appendFile( data, path )- Appends the string indatato the file atpath, creating the file if it does not yet exists.dumpAttributes( path )- Prints the file system attributes of the file/folder atpathto the console.cpFile( src, dst )- Copies the a filesrcto the folderdst.cpFolder( src, dst )- Copies the a foldersrcto the folderdst.exists( path )- Returnstrueif the file atpathexists. Returnsfalseotherwise.isFile( path )- Returnstrueif the file atpathis in fact a file and not some other file type. Returnsfalseotherwise.isFolder( path )- - Returnstrueif the file atpathis in fact a folder and not some other file type. Returnsfalseotherwise.loadTable( path, secure )- Reads a JSON encoded text file atpathand returns it as a decoded table. Optionally uses the ssk.security system ifsecureis specified and `true.mkFolder( path )- Makes a folder namedpath.- Tip: - This can only make the final folder in the path and will not create entire hieararchies of folders if they do not exist yet.
mvFile( src, dst )- Moves the file atsrctodst, wheresrcanddstare complete paths.mvFolder( src, dst )- Moves the folder atsrctodst, wheresrcanddstare complete paths.readFile( path )- Returns a string containing the contents of the file atpathornilif the file cannot be read.readFileToTable( path )- Returns a table containing the contents of the file atpathor{}if the file cannot be read.- Tip: - This table is numerically indexed and each entry represents a line in the file separated by the newline character
\n.
- Tip: - This table is numerically indexed and each entry represents a line in the file separated by the newline character
repairPath( path, forceForward )- Returns a string with the slashes leaning in the right direction for the current OS.- If
forceForwardis specified andtrue, the slashes will all be forced to be forward leaning.
- If
rmFile( path )- Removes the file or folder atpath.rmFolder( path )- Removes the folder atpath.saveTable( tbl, path, secure )- Saves tabletblas a JSON encoded text file topathand optionally uses the ssk.security system ifsecureis specified and `true.writeFile( data, path )- Writes the stringdatato the file atpath, replacing the file if it already exists.
Copyright © Roaming Gamer, LLC. 2008-2016; All Rights Reserved