Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

File System

Ibnu Yahya edited this page Jul 31, 2014 · 9 revisions

How to Access a System File on IGN SDK.

INIT

  • var fs = ign.filesystem();

How to use in source code program

<!doctype html>
<html>
<head>
<script type="text/javascript" src="qrc:///js/jquery.js"></script>
<script type="text/javascript" src="qrc:///js/ign.js"></script>
<script type="text/javascript">
var fs = ign.filesystem();
$(document).ready(function(){
    //check home path
    $('#homepath').click(function(){
        alert("Your HOME PATH : "+fs.homePath());
    });
    //check app path
    $('#apppath').click(function(){
        alert("Your APP PATH : "+fs.appPath());
    });
});
</script>
</head>
<body>
<button id="homepath">Checking Home Path!</button>
<button id="apppath">Checking Application Path!</button>
</body>
</html>

System Path

  • Home Path

fs.homePath() used to get path of home (home path).

  • Application Path

fs.appPath() used to get path of application (app path).

  • Set Url

fs.setUrl('url') used to set a url to be loaded.

Checking File or Directory

  • File or Directory exist

fs.axists("/PATH/to/file") used to check a file or directory is exist or not. Output is bool.

  • Checking Directory

fs.isDirectory("/PATH/to/file") is used to check a directory. Output is bool

  • Checking File

fs.isFile("/PATH/to/file") is used to check a file. Output is bool

  • Absolute Directory

fs.isAbsolute("/PATH/to/file") is used to check absolute directory. Output is bool

  • Executable File

fs.isExecutable("/PATH/to/file") is used to check an executable file. Output is bool

  • Writable File

fs.isWritable("/PATH/to/file") is used to check a writable file. Output is bool

  • Symbolic Link

fs.isLink("/PATH/to/file") is used to check a symbolic link. Output is bool

Handling Directory

A handling can be used to a directory on IGN SDK. Used by fs.dir("options","/PATH/to/file"). Options is :

  • "remove" used to remove a directory

  • "create" used to create a directory. Output is bool

Handling File

  • File Remove

fs.fileRemove("/PATH/to/file"). is used to delete a file. Output is bool

  • File Write

fs.fileWrite("/PATH/to/file","input"). is used to create a document on file that type data on input is String. Output is bool

  • File Read

fs.fileRead("/PATH/to/file"). used to read a file on path. Output is string

  • Copy File

fs.copy('source','destination'). used to copy file from sorce address to destination address. Example fs.copy('/home/igos/Downloads/ignsdk_manual.pdf','/run/media/Disk/')

Complete tutorial can be found on http://blog.ignsdk.web.id/?p=766#more-766

Webview Action

  • Webview Copy

ign.copy() used to copy content from webview to clipboard

  • Webview Cut

ign.cut() used to cut content from webview to clipboard

  • Webview Paste

ign.paste() used to paste content from clipboard to webview

  • Webview Undo

ign.undo() used to undo last editing action in webview

  • Webview Redo

ign.redo() used to redo last editing action in webview

Open Dialog

  • Open File Dialog

fs.openFileDialog() . is used to select a file with method open file dialog. With this function we can select a custom file on new dialog file browser.

  • Open Dir Dialog

fs.openDirDialog() . is used to select a directory with method open fdirectory dialog. With this function we can select a custom file on new dialog directory browser.

  • Save File Dialog

fs.saveFileDialog() . This is a convenience static function that will return a file name selected by the user. The file does not have to exist.

Clone this wiki locally