[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n### Expected Behaviour\n\n### Actual Behaviour\n\n### Reproduce Scenario (including but not limited to)\n\n#### Steps to Reproduce\n\n#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)\n\n#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)\n\n#### Cordova CLI info\n\n    cordova info\n\nHere is the output:\n\n\n#### Plugin version\n\n    cordova plugin version | grep cordova-plugin-file-opener2\n\nHere is the output:\n\n\n#### Sample Code that illustrates the problem\n\n#### Logs taken while reproducing problem\nRun \n\n`adb logcat PluginManager:V CordovaPlugin:V CordovaLog:V chromium:V *:S` \n\nwhile testing the bug in your app to get some output from your error. This will help you to understand more about the nature of your problem.\n\n"
  },
  {
    "path": ".gitignore",
    "content": "*.class\n*.metals\n*.vscode\n\n# Package Files #\n*.jar\n*.war\n*.ear\n*.bak\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": " ⛔️  NO LONGER MAINTAINED ⛔️ \r\n\r\nThis plugin was originally built back in 2013 to provide an easy way to open files in Cordova applications. Since 2018 the plugin has not been actively maintained, with only the occaisional release to support updates from the community. Due to signficant changes in the way that Android handles permissions from version 11 onwards, this plugin does not work with Android 11 or later and would require significant changes to make this happen. \r\n\r\nIf someone would like to take on this work and maintain the plugin moving forward please get in touch.\r\n\r\n----------\r\n\r\n# A File Opener Plugin for Cordova\r\n\r\n[![Latest Stable Version](https://img.shields.io/npm/v/cordova-plugin-file-opener2.svg)](https://www.npmjs.com/package/cordova-plugin-file-opener2) [![Total Downloads](https://img.shields.io/npm/dt/cordova-plugin-file-opener2.svg)](https://npm-stat.com/charts.html?package=cordova-plugin-file-opener2)\r\n\r\nThis plugin will open a file on your device file system with its default application.\r\n\r\n```js\r\ncordova.plugins.fileOpener2.open(\r\n    filePath,\r\n    fileMIMEType,\r\n    {\r\n        error : function(){ },\r\n        success : function(){ }\r\n    }\r\n);\r\n```\r\n\r\n## Installation\r\n\r\n```shell\r\n$ cordova plugin add cordova-plugin-file-opener2\r\n```\r\n\r\n## Requirements\r\n\r\nThe following platforms and versions are supported by the latest release:\r\n\r\n- Android 5.1+ / iOS 9+ / Windows / Electron\r\n- Cordova CLI 7.0 or higher\r\n\r\nCordova CLI 6.0 is supported by 2.0.19, but there are a number of issues, particularly with Android builds (see [232](https://github.com/pwlin/cordova-plugin-file-opener2/issues/232) [203](https://github.com/pwlin/cordova-plugin-file-opener2/issues/203) [207](https://github.com/pwlin/cordova-plugin-file-opener2/issues/207)). Using the [cordova-android-support-gradle-release](https://github.com/dpa99c/cordova-android-support-gradle-release) plugin may help.\r\n\r\n### Support for Android 11 and later \r\nThere have been [reports](https://github.com/pwlin/cordova-plugin-file-opener2/issues/310) of issues using this plugin with Android 11 and later. \r\n\r\n### Edit support \r\nThe plugin currently does *not* support the editing of files on Android. It may support editing on iOS, but this has not been tested. \r\n\r\n## fileOpener2.open(filePath, mimeType, options)\r\n\r\nOpens a file\r\n\r\n### Supported Platforms\r\n\r\n- Android 5.1+\r\n- iOS 9+\r\n- Windows\r\n- Electron\r\n\r\n### Quick Examples\r\nOpen an APK install dialog:\r\n\r\n```javascript\r\ncordova.plugins.fileOpener2.open(\r\n    '/Downloads/gmail.apk',\r\n    'application/vnd.android.package-archive'\r\n);\r\n```\r\n\r\nOpen a PDF document with the default PDF reader and optional callback object:\r\n\r\n```js\r\ncordova.plugins.fileOpener2.open(\r\n    '/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf\r\n    'application/pdf',\r\n    {\r\n        error : function(e) {\r\n            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n        },\r\n        success : function () {\r\n            console.log('file opened successfully');\r\n        }\r\n    }\r\n);\r\n```\r\n\r\n__Note on Electron:__ Do not forget to enable Node.js in your app by adding `\"nodeIntegration\": true` to `platforms/electron/platform_www/cdv-electron-settings.json` file, See [Cordova-Electron documentation](https://cordova.apache.org/docs/en/latest/guide/platforms/electron/index.html#customizing-the-application's-window-options).\r\n\r\n### Market place installation\r\nInstall From Market: to install an APK from a market place, such as Google Play or the App Store, you can use an `<a>` tag in combination with the `market://` protocol:\r\n\r\n```html\r\n<a href=\"market://details?id=xxxx\" target=\"_system\">Install from Google Play</a>\r\n<a href=\"itms-apps://itunes.apple.com/app/my-app/idxxxxxxxx?mt=8\" target=\"_system\">Install from App Store</a>\r\n```\r\nor in code:\r\n\r\n```js\r\nwindow.open(\"[market:// or itms-apps:// link]\",\"_system\");\r\n```\r\n\r\n## fileOpener2.showOpenWithDialog(filePath, mimeType, options)\r\n\r\nOpens with system modal to open file with an already installed app.\r\n\r\n### Supported Platforms\r\n\r\n- Android 5.1+\r\n- iOS 9+\r\n\r\n### Quick Example\r\n\r\n```js\r\ncordova.plugins.fileOpener2.showOpenWithDialog(\r\n    '/Downloads/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf\r\n    'application/pdf',\r\n    {\r\n        error : function(e) {\r\n            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n        },\r\n        success : function () {\r\n            console.log('file opened successfully');\r\n        },\r\n        position : [0, 0]\r\n    }\r\n);\r\n```\r\n`position` array of coordinates from top-left device screen, use for iOS dialog positioning.\r\n\r\n## fileOpener2.uninstall(packageId, callbackContext)\r\n\r\nUninstall a package with its ID. \r\n\r\n__Note__: You need to add `<uses-permission android:name=\"android.permission.REQUEST_DELETE_PACKAGES\" />` to your `AndroidManifest.xml`\r\n\r\n### Supported Platforms\r\n\r\n- Android 5.1+\r\n\r\n### Quick Example\r\n```js\r\ncordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {\r\n    error : function(e) {\r\n        console.log('Error status: ' + e.status + ' - Error message: ' + e.message);\r\n    },\r\n    success : function() {\r\n        console.log('Uninstall intent activity started.');\r\n    }\r\n});\r\n```\r\n\r\n## fileOpener2.appIsInstalled(packageId, callbackContext)\r\n\r\nCheck if an app is already installed.\r\n\r\n### Supported Platforms\r\n\r\n- Android 5.1+\r\n\r\n### Quick Example\r\n```javascript\r\ncordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', {\r\n    success : function(res) {\r\n        if (res.status === 0) {\r\n            console.log('Adobe Reader is not installed.');\r\n        } else {\r\n            console.log('Adobe Reader is installed.')\r\n        }\r\n    }\r\n});\r\n```\r\n---\r\n\r\n## Android APK installation limitation\r\n\r\nThe following limitations apply when opening an APK file for installation:\r\n- On Android 8+, your application must have the `ACTION_INSTALL_PACKAGE` permission. You can add it by adding this to your app's `config.xml` file:\r\n```xml\r\n<platform name=\"android\">\r\n    <config-file parent=\"/manifest\" target=\"AndroidManifest.xml\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\r\n        <uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />\r\n    </config-file>\r\n</platform>\r\n```\r\n\r\n- Before Android 7, you can only install APKs from the \"external\" partition. For example, you can install from `cordova.file.externalDataDirectory`, but **not** from `cordova.file.dataDirectory`. Android 7+ does not have this limitation.\r\n\r\n---\r\n\r\n## SD card limitation on Android\r\n\r\nIt is not always possible to open a file from the SD Card using this plugin on Android. This is because the underlying  Android library used [does not support serving files from secondary external storage devices](https://stackoverflow.com/questions/40318116/fileprovider-and-secondary-external-storage). Whether or not your the SD card is treated as a secondary external device depends on your particular phone's set up.\r\n\r\n---\r\n\r\n## Notes\r\n\r\n- For properly opening _any_ file, you must already have a suitable reader for that particular file type installed on your device. Otherwise this will not work.\r\n\r\n- [It is reported](https://github.com/pwlin/cordova-plugin-file-opener2/issues/2#issuecomment-41295793) that in iOS, you might need to remove `<preference name=\"iosPersistentFileLocation\" value=\"Library\" />` from your `config.xml`\r\n\r\n- If you are wondering what MIME-type should you pass as the second argument to `open` function, [here is a list of all known MIME-types](http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co)\r\n\r\n\r\n---\r\n\r\n\r\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"cordova-plugin-file-opener2\",\n  \"version\": \"4.0.0\",\n  \"description\": \"A File Opener Plugin for Cordova. (The Original Version)\",\n  \"cordova\": {\n    \"id\": \"cordova-plugin-file-opener2\",\n    \"platforms\": [\n      \"android\",\n      \"ios\",\n      \"windows\",\n      \"electron\"\n    ]\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/pwlin/cordova-plugin-file-opener2.git\"\n  },\n  \"keywords\": [\n    \"ecosystem:cordova\",\n    \"cordova-android\",\n    \"cordova-ios\",\n    \"cordova-windows\",\n    \"cordova-electron\"\n  ],\n  \"engines\": {\n    \"cordovaDependencies\": {\n      \"2.0.0\": {\n        \"cordova\": \">=6.0.0\"\n      },\n      \"3.0.0\": {\n        \"cordova\": \">=7.0.0\"\n      },\n      \"4.0.0\": {\n        \"cordova-android\": \">=10.0.0\"\n      }\n    }\n  },\n  \"author\": {\n    \"name\": \"pwlin05@gmail.com\"\n  },\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/pwlin/cordova-plugin-file-opener2/issues\"\n  },\n  \"homepage\": \"https://github.com/pwlin/cordova-plugin-file-opener2#readme\"\n}\n"
  },
  {
    "path": "plugin.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<plugin xmlns=\"http://www.phonegap.com/ns/plugins/1.0\" xmlns:android=\"http://schemas.android.com/apk/res/android\" id=\"cordova-plugin-file-opener2\" version=\"4.0.0\">\n\n    <name>File Opener2</name>\n    <description>A File Opener Plugin for Cordova. (The Original Version)</description>\n    <license>MIT</license>\n\n    <js-module src=\"www/plugins.FileOpener2.js\" name=\"FileOpener2\">\n        <clobbers target=\"cordova.plugins.fileOpener2\" />\n    </js-module>\n\n    <!-- Android -->\n    <platform name=\"android\">\n        <source-file src=\"src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java\" target-dir=\"src/io/github/pwlin/cordova/plugins/fileopener2\" />\n        <source-file src=\"src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java\" target-dir=\"src/io/github/pwlin/cordova/plugins/fileopener2\" />\n        <config-file target=\"res/xml/config.xml\" parent=\"/*\">\n            <feature name=\"FileOpener2\">\n                <param name=\"android-package\" value=\"io.github.pwlin.cordova.plugins.fileopener2.FileOpener2\" />\n            </feature>\n        </config-file>\n        <config-file target=\"AndroidManifest.xml\" parent=\"/*\">\n            <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />\n        </config-file>\n        <config-file target=\"AndroidManifest.xml\" parent=\"application\">\n          <provider android:name=\"io.github.pwlin.cordova.plugins.fileopener2.FileProvider\" android:authorities=\"${applicationId}.fileOpener2.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\">\n            <meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/opener_paths\" />\n          </provider>\n        </config-file>\n        <source-file src=\"src/android/res/xml/opener_paths.xml\" target-dir=\"res/xml\" />\n    </platform>\n\n    <!-- iOS -->\n    <platform name=\"ios\">\n        <config-file target=\"config.xml\" parent=\"/*\">\n            <feature name=\"FileOpener2\">\n                <param name=\"ios-package\" value=\"FileOpener2\" />\n            </feature>\n        </config-file>\n        <source-file src=\"src/ios/FileOpener2.m\" />\n        <header-file src=\"src/ios/FileOpener2.h\" />\n    </platform>\n\n\t<!-- WP8 -->\n\t<platform name=\"wp8\">\n\t\t<config-file target=\"config.xml\" parent=\"/*\">\n\t\t  <feature name=\"FileOpener2\">\n\t\t\t<param name=\"wp-package\" value=\"FileOpener2\" />\n\t\t  </feature>\n\t\t</config-file>\n\t\t<source-file src=\"src/wp8/FileOpener2.cs\" />\n\t</platform>\n\n\t<!-- windows -->\n    <platform name=\"windows\">\n        <js-module src=\"src/windows/fileOpener2Proxy.js\" name=\"fileOpener2Proxy\">\n            <merges target=\"\" />\n        </js-module>\n    </platform>\n\n    <!-- browser -->\n    <platform name=\"browser\">\n      <config-file parent=\"/*\" target=\"config.xml\">\n          <feature name=\"FileOpener2\">\n              <param name=\"browser-package\" value=\"FileOpener2\"/>\n          </feature>\n      </config-file>\n\n      <!-- Required for browserify: we always link module below as there is conditional reference\n      to this module from requestFileSystem and resolveLocalFileSystemURI modules. -->\n      <js-module src=\"www/browser/isChrome.js\" name=\"isChrome\">\n          <runs />\n      </js-module>\n\n      <js-module src=\"src/browser/FileSaver.min.js\" name=\"FileSaver\">\n          <clobbers target=\"FileSaver\"/>\n      </js-module>\n\n      <js-module src=\"src/browser/FileOpener2.js\" name=\"FileOpener2Proxy\">\n          <runs/>\n      </js-module>\n    </platform>\n\n    <!-- electron -->\n    <platform name=\"electron\">\n        <js-module src=\"src/electron/FileOpener2.js\" name=\"fileOpener2\">\n            <merges target=\"\" />\n        </js-module>\n    </platform>\n\n</plugin>\n"
  },
  {
    "path": "src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java",
    "content": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\npackage io.github.pwlin.cordova.plugins.fileopener2;\n\nimport java.io.File;\nimport java.util.List;\n\nimport org.json.JSONArray;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.content.pm.ResolveInfo;\nimport android.net.Uri;\nimport android.os.Build;\nimport android.webkit.MimeTypeMap;\n\nimport io.github.pwlin.cordova.plugins.fileopener2.FileProvider;\n\nimport org.apache.cordova.CordovaPlugin;\nimport org.apache.cordova.CallbackContext;\nimport org.apache.cordova.PluginResult;\nimport org.apache.cordova.CordovaResourceApi;\n\npublic class FileOpener2 extends CordovaPlugin {\n\n\t/**\n\t * Executes the request and returns a boolean.\n\t *\n\t * @param action\n\t *            The action to execute.\n\t * @param args\n\t *            JSONArry of arguments for the plugin.\n\t * @param callbackContext\n\t *            The callback context used when calling back into JavaScript.\n\t * @return boolean.\n\t */\n\tpublic boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {\n\t\tif (action.equals(\"open\")) {\n\t\t\tString fileUrl = args.getString(0);\n\t\t\tString contentType = args.getString(1);\n\t\t\tBoolean openWithDefault = true;\n\t\t\tif(args.length() > 2){\n\t\t\t\topenWithDefault = args.getBoolean(2);\n\t\t\t}\n\t\t\tthis._open(fileUrl, contentType, openWithDefault, callbackContext);\n\t\t}\n\t\telse if (action.equals(\"uninstall\")) {\n\t\t\tthis._uninstall(args.getString(0), callbackContext);\n\t\t}\n\t\telse if (action.equals(\"appIsInstalled\")) {\n\t\t\tJSONObject successObj = new JSONObject();\n\t\t\tif (this._appIsInstalled(args.getString(0))) {\n\t\t\t\tsuccessObj.put(\"status\", PluginResult.Status.OK.ordinal());\n\t\t\t\tsuccessObj.put(\"message\", \"Installed\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsuccessObj.put(\"status\", PluginResult.Status.NO_RESULT.ordinal());\n\t\t\t\tsuccessObj.put(\"message\", \"Not installed\");\n\t\t\t}\n\t\t\tcallbackContext.success(successObj);\n\t\t}\n\t\telse {\n\t\t\tJSONObject errorObj = new JSONObject();\n\t\t\terrorObj.put(\"status\", PluginResult.Status.INVALID_ACTION.ordinal());\n\t\t\terrorObj.put(\"message\", \"Invalid action\");\n\t\t\tcallbackContext.error(errorObj);\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate void _open(String fileArg, String contentType, Boolean openWithDefault, CallbackContext callbackContext) throws JSONException {\n\t\tString fileName = \"\";\n\t\ttry {\n\t\t\tCordovaResourceApi resourceApi = webView.getResourceApi();\n\t\t\tUri fileUri = resourceApi.remapUri(Uri.parse(fileArg));\n\t\t\tfileName = fileUri.getPath();\n\t\t} catch (Exception e) {\n\t\t\tfileName = fileArg;\n\t\t}\n\t\tFile file = new File(fileName);\n\t\tif (file.exists()) {\n\t\t\ttry {\n\t\t\t\tif (contentType == null || contentType.trim().equals(\"\")) {\n\t\t\t\t    contentType = _getMimeType(fileName);\n\t\t\t\t}\n\n\t\t\t\tIntent intent;\n\t\t\t\tif (contentType.equals(\"application/vnd.android.package-archive\")) {\n\t\t\t\t\t// https://stackoverflow.com/questions/9637629/can-we-install-an-apk-from-a-contentprovider/9672282#9672282\n\t\t\t\t\tintent = new Intent(Intent.ACTION_INSTALL_PACKAGE);\n\t\t\t\t\tUri path;\n\t\t\t\t\tif (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {\n\t\t\t\t\t\tpath = Uri.fromFile(file);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tContext context = cordova.getActivity().getApplicationContext();\n\t\t\t\t\t\tpath = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + \".fileOpener2.provider\", file);\n\t\t\t\t\t}\n\t\t\t\t\tintent.setDataAndType(path, contentType);\n\t\t\t\t\tintent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);\n\n\t\t\t\t} else {\n\t\t\t\t\tintent = new Intent(Intent.ACTION_VIEW);\n\t\t\t\t\tContext context = cordova.getActivity().getApplicationContext();\n\t\t\t\t\tUri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + \".fileOpener2.provider\", file);\n\t\t\t\t\tintent.setDataAndType(path, contentType);\n\t\t\t\t\tintent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * @see\n\t\t\t\t * http://stackoverflow.com/questions/14321376/open-an-activity-from-a-cordovaplugin\n\t\t\t\t */\n\t\t\t\t if(openWithDefault){\n\t\t\t\t\t cordova.getActivity().startActivity(intent);\n\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t\t cordova.getActivity().startActivity(Intent.createChooser(intent, \"Open File in...\"));\n\t\t\t\t }\n\n\t\t\t\tcallbackContext.success();\n\t\t\t} catch (android.content.ActivityNotFoundException e) {\n\t\t\t\tJSONObject errorObj = new JSONObject();\n\t\t\t\terrorObj.put(\"status\", PluginResult.Status.ERROR.ordinal());\n\t\t\t\terrorObj.put(\"message\", \"Activity not found: \" + e.getMessage());\n\t\t\t\tcallbackContext.error(errorObj);\n\t\t\t}\n\t\t} else {\n\t\t\tJSONObject errorObj = new JSONObject();\n\t\t\terrorObj.put(\"status\", PluginResult.Status.ERROR.ordinal());\n\t\t\terrorObj.put(\"message\", \"File not found\");\n\t\t\tcallbackContext.error(errorObj);\n\t\t}\n\t}\n\n\tprivate String _getMimeType(String url) {\n\t    String mimeType = \"*/*\";\n\t    int extensionIndex = url.lastIndexOf('.');\n\t    if (extensionIndex > 0) {\n\t\tString extMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(url.substring(extensionIndex+1));\n\t\tif (extMimeType != null) {\n\t\t    mimeType = extMimeType;\n\t\t}\n\t    }\n\t    return mimeType;\n\t}\n\n\tprivate void _uninstall(String packageId, CallbackContext callbackContext) throws JSONException {\n\t\tif (this._appIsInstalled(packageId)) {\n\t\t\tIntent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);\n\t\t\tintent.setData(Uri.parse(\"package:\" + packageId));\n\t\t\tcordova.getActivity().startActivity(intent);\n\t\t\tcallbackContext.success();\n\t\t}\n\t\telse {\n\t\t\tJSONObject errorObj = new JSONObject();\n\t\t\terrorObj.put(\"status\", PluginResult.Status.ERROR.ordinal());\n\t\t\terrorObj.put(\"message\", \"This package is not installed\");\n\t\t\tcallbackContext.error(errorObj);\n\t\t}\n\t}\n\n\tprivate boolean _appIsInstalled(String packageId) {\n\t\tPackageManager pm = cordova.getActivity().getPackageManager();\n        boolean appInstalled = false;\n        try {\n            pm.getPackageInfo(packageId, PackageManager.GET_ACTIVITIES);\n            appInstalled = true;\n        } catch (PackageManager.NameNotFoundException e) {\n            appInstalled = false;\n        }\n        return appInstalled;\n\t}\n\n}\n\n"
  },
  {
    "path": "src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java",
    "content": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\npackage io.github.pwlin.cordova.plugins.fileopener2;\n\n/*\n * http://stackoverflow.com/questions/40746144/error-with-duplicated-fileprovider-in-manifest-xml-with-cordova/41550634#41550634\n */\npublic class FileProvider extends androidx.core.content.FileProvider {\n}\n"
  },
  {
    "path": "src/android/res/xml/opener_paths.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles -->\n<paths xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- cordova.file.dataDirectory -->\n    <files-path name=\"files\" path=\".\" />\n    <!-- cordova.file.cacheDirectory -->\n    <cache-path name=\"cache\" path=\".\" />\n    <!-- cordova.file.externalDataDirectory -->\n    <external-files-path name=\"external-files\" path=\".\" />\n    <!-- cordova.file.externalCacheDirectory -->\n    <external-cache-path name=\"external-cache\" path=\".\" />\n    <!-- cordova.file.externalRootDirectory -->\n    <external-path name=\"external\" path=\".\" />\n</paths>\n"
  },
  {
    "path": "src/browser/FileOpener2.js",
    "content": "/*\r\nThe MIT License (MIT)\r\n\r\nCopyright (c) 2019 fefc - fefc.dev@gmail.com\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of\r\nthis software and associated documentation files (the \"Software\"), to deal in\r\nthe Software without restriction, including without limitation the rights to\r\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r\nthe Software, and to permit persons to whom the Software is furnished to do so,\r\nsubject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n*/\r\n\r\nconst cacheDirectory = (require('./isChrome')()) ? 'filesystem:' + window.location.origin + '/temporary/' : 'file:///temporary/';\r\nconst dataDirectory = (require('./isChrome')()) ? 'filesystem:' + window.location.origin + '/persistent/' : 'file:///persistent/';\r\n\r\nfunction open(successCallback, errorCallback, data) {\r\n  var fullFilePath = data[0];\r\n  //var contentType = data[1]; //Not needed in browser\r\n  //var openDialog = data[2]; //Not needed in browser\r\n\r\n  var dirPath = fullFilePath.substring(0, fullFilePath.lastIndexOf('/') + 1);\r\n  var fileName = fullFilePath.substring(fullFilePath.lastIndexOf('/') + 1, fullFilePath.length);\r\n  var fileSystemLocalPath = getLocalPathAndFileSystem(dirPath);\r\n\r\n  if (!fileSystemLocalPath.error) {\r\n    window.requestFileSystem(fileSystemLocalPath.fileSystem, 0, (fs) => {\r\n      readFile(fs.root, fileSystemLocalPath.localPath + fileName).then((blob) => {\r\n        FileSaver.saveAs(blob, fileName);\r\n        successCallback();\r\n      }).catch((error) => {\r\n        errorCallback(error);\r\n      });\r\n    }, (error) => {\r\n      errorCallback(error);\r\n    });\r\n  } else {\r\n    errorCallback('INVALID_PATH');\r\n  }\r\n}\r\n\r\n/**\r\n *\r\n * Gets the localPath according to the fileSystem (TEMPORARY or PERSISTENT).\r\n *\r\n * @param {String} Path to the file or directory to check\r\n * @returns {Object} value with informations to requestFileSystem later\r\n * @returns {string} value.localPath The localPath in relation with fileSystem.\r\n * @returns {number} value.fileSystem the fileSystem (TEMPORARY or PERSISTENT).\r\n * @returns {error} value.error if the path is not valid.\r\n * @returns {message} value.message error message.\r\n */\r\nfunction getLocalPathAndFileSystem(pathToCheck) {\r\n  let ret = {\r\n    localPath: '',\r\n    fileSystem: window.TEMPORARY\r\n  };\r\n\r\n  if (pathToCheck.startsWith(cacheDirectory)) {\r\n    ret.localPath = pathToCheck.replace(cacheDirectory, '');\r\n    ret.fileSystem = window.TEMPORARY;\r\n\r\n  } else if (pathToCheck.startsWith(dataDirectory)) {\r\n    ret.localPath = pathToCheck.replace(dataDirectory, '');\r\n    ret.fileSystem = window.PERSISTENT;\r\n\r\n  } else {\r\n    return {error: true, message: 'INVALID_PATH'};\r\n  }\r\n\r\n  if (!ret.localPath.endsWith('/')) ret.localPath += '/';\r\n\r\n  return ret;\r\n}\r\n\r\n/**\r\n *\r\n * Reads a file in the fileSystem as an DataURL.\r\n *\r\n * @param {String} Root is the root folder of the fileSystem.\r\n * @param {String} Path is the file to be red.\r\n * @returns {Promise} which resolves with an Object containing DataURL, rejects if something went wrong.\r\n */\r\nfunction readFile(root, filePath) {\r\n  return new Promise((resolve, reject) => {\r\n    if (filePath.startsWith('/')) filePath = filePath.substring(1);\r\n\r\n    root.getFile(filePath, {}, (fileEntry) => {\r\n      fileEntry.file((file) => {\r\n        let reader = new FileReader();\r\n\r\n        reader.onload = function() {\r\n          resolve(reader.result);\r\n        };\r\n\r\n        reader.onerror = function() {\r\n          reject(reader.error);\r\n        }\r\n\r\n        reader.readAsDataURL(file);\r\n\r\n      }, (error) => {\r\n        reject(error);\r\n      });\r\n    }, (error) => {\r\n      reject(error);\r\n    });\r\n  });\r\n}\r\n\r\nmodule.exports = {\r\n  open: open\r\n};\r\n\r\nrequire( \"cordova/exec/proxy\" ).add( \"FileOpener2\", module.exports );\r\n"
  },
  {
    "path": "src/electron/FileOpener2.js",
    "content": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2020 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n// https://www.electronjs.org/docs/api/shell\nconst { shell } = global.require('electron');\nmodule.exports = {\n  open: function (onSuccess, onError, fileName) {\n    var opn = shell.openItem(fileName[0]);\n    if (opn === true) {\n      onSuccess(true);\n    } else {\n      onError({'status': 0, 'message': 'Failed opening file.'});\n    }\n  }\n};\nrequire('cordova/exec/proxy').add('FileOpener2', module.exports);\n"
  },
  {
    "path": "src/ios/FileOpener2.h",
    "content": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#import <Cordova/CDV.h>\n\n@interface FileOpener2 : CDVPlugin <UIDocumentInteractionControllerDelegate> {\n    NSString *localFile;\n}\n\n@property(nonatomic, strong) UIDocumentInteractionController *controller;\n@property(nonatomic, strong) CDVViewController *cdvViewController;\n\n- (void) open: (CDVInvokedUrlCommand*)command;\n\n@end"
  },
  {
    "path": "src/ios/FileOpener2.m",
    "content": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n#import \"FileOpener2.h\"\n#import <Cordova/CDV.h>\n\n#import <QuartzCore/QuartzCore.h>\n#import <MobileCoreServices/MobileCoreServices.h>\n\n@implementation FileOpener2\n@synthesize controller = docController;\n\nCDVPluginResult* pluginResult = nil;\nNSString* callbackId = nil;\n\n- (void) open: (CDVInvokedUrlCommand*)command {\n\tcallbackId = command.callbackId;\n\tNSString *path = [command.arguments objectAtIndex:0];\n\tNSString *contentType = [command.arguments objectAtIndex:1];\n\tBOOL showPreview = YES;\n\n\tif ([command.arguments count] >= 3) {\n\t\tshowPreview = [[command.arguments objectAtIndex:2] boolValue];\n\t}\n\n\tCDVViewController* cont = (CDVViewController*)[super viewController];\n\tself.cdvViewController = cont;\n\tNSString *uti = nil;\n\n\tif ([contentType length] == 0) {\n\t\tNSArray *dotParts = [path componentsSeparatedByString:@\".\"];\n\t\tNSString *fileExt = [dotParts lastObject];\n\n\t\tuti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExt, NULL);\n\t} else {\n\t\tuti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (__bridge CFStringRef)contentType, NULL);\n\t}\n\n\tdispatch_async(dispatch_get_main_queue(), ^{\n\t\tNSURL *fileURL = NULL;\n\t\tNSString *decodedPath = [path stringByRemovingPercentEncoding];\n\n\t\tif ([path isEqualToString:decodedPath]) {\n\t\t\tNSLog(@\"Path parameter not encoded. Building file URL encoding it...\");\n\t\t\tfileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@\"file://\" withString:@\"\"]];;\n\t\t} else {\n\t\t\tNSLog(@\"Path parameter already encoded. Building file URL without encoding it...\");\n\t\t\tfileURL = [NSURL URLWithString:path];\n\t\t}\n\n\t\tlocalFile = fileURL.path;\n\n\t\tNSLog(@\"looking for file at %@\", fileURL);\n\t\tNSFileManager *fm = [NSFileManager defaultManager];\n\n    \tif (![fm fileExistsAtPath:localFile]) {\n\t    \tNSDictionary *jsonObj = @{@\"status\" : @\"9\",\n\t    \t@\"message\" : @\"File does not exist\"};\n\t    \tCDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];\n\t    \t[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];\n\t    \treturn;\n    \t}\n\n\t\tdocController = [UIDocumentInteractionController  interactionControllerWithURL:fileURL];\n\t\tdocController.delegate = self;\n\t\tdocController.UTI = uti;\n\n\t\t//Opens the file preview\n\t\tCGRect rect;\n\n\t\tif ([command.arguments count] >= 4) {\n\t\t\tNSArray *positionValues = [command.arguments objectAtIndex:3];\n\n\t\t\tif (![positionValues isEqual:[NSNull null]] && [positionValues count] >= 2) {\n\t\t\t\trect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]);\n\t\t\t} else {\n\t\t\t\trect = CGRectMake(0, 0, 0, 0);\n\t\t\t}\n\t\t} else {\n\t\t\trect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);\n\t\t}\n\n\t\tBOOL wasOpened = NO;\n\n\t\tif (showPreview) {\n\t\t\twasOpened = [docController presentPreviewAnimated: NO];\n\t\t} else {\n\t\t\tCDVViewController* cont = self.cdvViewController;\n\t\t\twasOpened = [docController presentOpenInMenuFromRect:rect inView:cont.view animated:YES];\n\t\t}\n\n\t\tif (wasOpened) {\n\t\t\tpluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @\"\"];\n\t\t} else {\n\t\t\tNSDictionary *jsonObj = [ [NSDictionary alloc]\n\t\t\t\tinitWithObjectsAndKeys :\n\t\t\t\t@\"9\", @\"status\",\n\t\t\t\t@\"Could not handle UTI\", @\"message\",\n\t\t\t\tnil\n\t\t\t];\n\t\t\tpluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];\n        \t[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];\n\t\t}\n\t});\n}\n\n@end\n\n@implementation FileOpener2 (UIDocumentInteractionControllerDelegate)\n- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller {\n\t[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];\n}\n\n- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {\n\t[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];\n}\n\n- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {\n\tUIViewController *presentingViewController = self.viewController;\n\n\tif (presentingViewController.view.window != [UIApplication sharedApplication].keyWindow) {\n\t\tpresentingViewController = [UIApplication sharedApplication].keyWindow.rootViewController;\n\t}\n\n\twhile (presentingViewController.presentedViewController != nil && ![presentingViewController.presentedViewController isBeingDismissed]) {\n\t\tpresentingViewController = presentingViewController.presentedViewController;\n\t}\n\n\treturn presentingViewController;\n}\n\n@end\n"
  },
  {
    "path": "src/windows/fileOpener2Proxy.js",
    "content": "\n\tvar cordova = require('cordova'),\n\t\tfileOpener2 = require('./FileOpener2');\n\n\tvar schemes = [\n        { protocol: 'ms-app', getFile: getFileFromApplicationUri },\n        { protocol: 'cdvfile', getFile: getFileFromFileUri }    //protocol cdvfile\n\t]\n\n\tfunction nthIndex(str, pat, n) {\n\t    var L = str.length, i = -1;\n\t    while (n-- && i++ < L) {\n\t        i = str.indexOf(pat, i);\n\t        if (i < 0) break;\n\t    }\n\t    return i;\n\t}\n\n\tfunction getFileFromApplicationUri(uri) {\n\t    /* bad path from a file entry due to the last '//' \n               example: ms-appdata:///local//path/to/file\n            */\n\t    var index = nthIndex(uri, \"//\", 3);\n\t    var newUri = uri.substr(0, index) + uri.substr(index + 1);\n\n\t    var applicationUri = new Windows.Foundation.Uri(newUri);\n\n\t    return Windows.Storage.StorageFile.getFileFromApplicationUriAsync(applicationUri);\n\t}\n\n\tfunction getFileFromFileUri(uri) {\n\t    /* uri example:\n               cdvfile://localhost/persistent|temporary|another-fs-root/path/to/file\n            */\n\t    var indexFrom = nthIndex(uri, \"/\", 3) + 1;\n\t    var indexTo = nthIndex(uri, \"/\", 4);\n\t    var whichFolder = uri.substring(indexFrom, indexTo);\n\t    var filePath = uri.substr(indexTo + 1);\n\t    var path = \"\\\\\" + filePath;\n\n\t    if (whichFolder == \"persistent\") {\n\t        path = Windows.Storage.ApplicationData.current.localFolder.path + path;\n\t    }\n\t    else {  //temporary, note: no roaming management\n\t        path = Windows.Storage.ApplicationData.current.temporaryFolder.path + path;\n\t    }\n\n\t    return getFileFromNativePath(path);\n\t}\n\n\tfunction getFileFromNativePath(path) {\n\t    var nativePath = path.split(\"/\").join(\"\\\\\");\n\n\t    return Windows.Storage.StorageFile.getFileFromPathAsync(nativePath);\n\t}\n\n\tfunction getFileLoaderForScheme(path) {\n\t    var fileLoader = getFileFromNativePath;\n\n\t    schemes.some(function (scheme) {\n\t        return path.indexOf(scheme.protocol) === 0 ? ((fileLoader = scheme.getFile), true) : false;\n\t    });\n\n\t    return fileLoader;\n\t}\n\n\tmodule.exports = {\n\n\t    open: function (successCallback, errorCallback, args) {\n\t        \n\t        var path = args[0];\n\t        \n\t        var getFile = getFileLoaderForScheme(path);\n\t        \n\t        getFile(path).then(function (file) {\n\t            var options = new Windows.System.LauncherOptions();\n\t            \n                try{\n\t                Windows.System.Launcher.launchFileAsync(file, options).then(function (success) {\n\t                    successCallback();\n\t                }, function (error) {\n\t                    errorCallback(error);\n\t                });\n                }catch(error){\n                    errorCallback(error);\n                }\n\n\t        }, function (error) {\n\t            console.log(\"Error while opening the file: \"+error);\n\t\t    errorCallback(error);\n\t        });\n\t\t}\n\t\t\n\t};\n\n\trequire(\"cordova/exec/proxy\").add(\"FileOpener2\", module.exports);\n\n"
  },
  {
    "path": "www/browser/isChrome.js",
    "content": "/*\n *\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n */\n\nmodule.exports = function () {\n    // window.webkitRequestFileSystem and window.webkitResolveLocalFileSystemURL are available only in Chrome and\n    // possibly a good flag to indicate that we're running in Chrome\n    return window.webkitRequestFileSystem && window.webkitResolveLocalFileSystemURL;\n};\n"
  },
  {
    "path": "www/plugins.FileOpener2.js",
    "content": "/*jslint browser: true, devel: true, node: true, sloppy: true, plusplus: true*/\n/*global require, cordova */\n/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nvar exec = require('cordova/exec');\n\nfunction FileOpener2() {}\n\nFileOpener2.prototype.open = function (fileName, contentType, callbackContext) {\n    contentType = contentType || '';\n    callbackContext = callbackContext || {};\n    exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType]);\n};\n\nFileOpener2.prototype.showOpenWithDialog = function (fileName, contentType, callbackContext) {\n    contentType = contentType || '';\n    callbackContext = callbackContext || {};\n    exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType, false, callbackContext.position || [0, 0]]);\n};\n\nFileOpener2.prototype.uninstall = function (packageId, callbackContext) {\n    callbackContext = callbackContext || {};\n    exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'uninstall', [packageId]);\n};\n\nFileOpener2.prototype.appIsInstalled = function (packageId, callbackContext) {\n    callbackContext = callbackContext || {};\n    exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'appIsInstalled', [packageId]);\n};\n\nmodule.exports = new FileOpener2();\n"
  }
]