What files will go to the plugin folder and how to access them

What files will go to the "plugin" folder?

For each PowerServer application, a "plugin" folder will be created automatically under the application directory (so called sandbox on the mobile device and so called cache directory on the Web client) to store any external files created or used by the application. These external files include

  • Any files created by the API calls, such as photos or videos created by the Camera APIs, bar code images created by the Barcode APIs, log files created by the of_log API etc.

  • Any files downloaded from the Appeon File Server, such as PDF files, image files, multimedia files, text files, etc.

    For instructions on how to upload and download files from Appeon File Server, see Configuring and deploying Appeon File Server and Uploading and downloading files.

  • Any files deployed to PowerServer from PowerServer Toolkit and downloaded from the PowerServer at runtime, such as PDF files, image files, multimedia files, text files, DLL/OCX files, etc.

    For instructions on how to deploy these files to PowerServer, see Deploy External Files in PowerServer Toolkit User Guide.

  • Any files created by the SaveAs function of the DataWindow control, the DataWindowChild object, or the DataStore object, such as PDF files, text files, HTML files, excel files etc.

How files go there?

All of the above files are automatically saved to the "plugin" folder, no matter they are new files created by the API or function calls or pre-existing files downloaded from the server to the client.

You can also save a file to the blob fields in the database, then read the blob data via the SQL statement, and then write the file to the "plugin" folder by using the PB FileWrite function.

How to reference these files in the script?

To programmatically use the files under the "plugin" folder, you will need to take advantage of a function provided by PowerServer, to get the full directory of the application directory. You can either use the AppeonGetCacheDir global function or the of_getcachedir function of the AppeonExtFuncs object. They work exactly the same. For example, appeongetcachedir() + "/plugin/test.pdf" or of_getcachedir() + "/plugin/test.pdf".

For some functions, such as the PB file functions (except for operating the INI files), the directory is automatically default to the "plugin" directory. For example, FileExists ("c:\test\test.txt") will be executed as FileExists (appeongetcachedir() + "/plugin/test.txt").