Installation
FileKit provides a platform-agnostic file abstraction calledPlatformFile
. It allows you to work with files in a platform-agnostic way. You can create, read, write, and delete files using the PlatformFile
API.
You can use PlatformFile
in your project by adding the following dependency:
Platform-specific setup
FileKit Core is designed to work out of the box for most platforms, but some targets require additional setup.Android setup
FileKit Core is automatically initialized in Android applications. It uses App Startup to initialize the library, ensuring that it is ready to use when your app starts. If for some reason you want to disable App Startup in your app, you can initialize FileKit manually by callingFileKit.manualFileKitCoreInitialization(context)
in your MainActivity
or Application
class.
JVM setup
FileKit needs to have your application id to handle the app directory. Your application id is generally the package name or the name of your application. FileKit will use thisappId
as app directory.
We recommend you to initialize FileKit in your main.kt
file:
main.kt
- Windows:
%APPDATA%\your.application.id\
- macOS:
~/Library/Application Support/your.application.id/
- Linux:
~/.local/share/your.application.id/
Custom Cache and Data Directories
For applications that need custom directory paths (e.g., portable applications or specific deployment scenarios), you can specify custom cache and data directories:main.kt
ProGuard Configuration
If you’re using ProGuard or code obfuscation on JVM platforms, add these rules to yourproguard-rules.pro
: