mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-09-07 07:43:26 +00:00

* chore: run flutter create on flowy_sdk * chore: rename flowy-sdk to flowy-core * chore: rename flowy_sdk to appflowy_backend * chore: fix windows build * chore: replace bloctest with test Co-authored-by: nathan <nathan@appflowy.io> Co-authored-by: vedon <vedon.fu@gmail.com>
46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:appflowy_backend/appflowy_backend.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
import '../startup.dart';
|
|
|
|
class InitRustSDKTask extends LaunchTask {
|
|
InitRustSDKTask({
|
|
this.directory,
|
|
});
|
|
|
|
// Customize the RustSDK initialization path
|
|
final Future<Directory>? directory;
|
|
|
|
@override
|
|
LaunchTaskType get type => LaunchTaskType.dataProcessing;
|
|
|
|
@override
|
|
Future<void> initialize(LaunchContext context) async {
|
|
// use the custom directory
|
|
if (directory != null) {
|
|
return directory!.then((directory) async {
|
|
await context.getIt<FlowySDK>().init(directory);
|
|
});
|
|
} else {
|
|
return appFlowyDocumentDirectory().then((directory) async {
|
|
await context.getIt<FlowySDK>().init(directory);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
Future<Directory> appFlowyDocumentDirectory() async {
|
|
switch (integrationEnv()) {
|
|
case IntegrationMode.develop:
|
|
Directory documentsDir = await getApplicationDocumentsDirectory();
|
|
return Directory('${documentsDir.path}/flowy_dev').create();
|
|
case IntegrationMode.release:
|
|
Directory documentsDir = await getApplicationDocumentsDirectory();
|
|
return Directory('${documentsDir.path}/flowy').create();
|
|
case IntegrationMode.test:
|
|
return Directory("${Directory.current.path}/.sandbox");
|
|
}
|
|
}
|