Skip to content

Commit

Permalink
Minor Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitsangwan01 committed Aug 17, 2024
1 parent ed9a376 commit e980397
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/app/services/app_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AppService {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
appVersion = packageInfo.version;
initLogger(
await fileService.logsDirectory,
fileService.logsDirectory,
maxFileCount: 5,
maxFileLength: 5 * 1024 * 1024,
);
Expand Down
12 changes: 7 additions & 5 deletions lib/app/services/file_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ class FileService {
_ => null,
};

Future<String> get dbDirectory => _getDirectory('db');
String get dbDirectory => _getDirectory('db');

Future<String> get logsDirectory => _getDirectory('logs');
String get logsDirectory => _getDirectory('logs');

String get assetsDirectory => _getDirectory('assets');

String uniHubAndroidServerFile = 'UniHubServer_0.1.jar';

Expand Down Expand Up @@ -70,11 +72,11 @@ class FileService {
}

/// Create a directory in cache folder
Future<String> _getDirectory(String name) async {
String _getDirectory(String name) {
String path = join(_cachePath, name);
Directory directory = Directory(path);
if (await directory.exists()) return path;
await directory.create(recursive: true);
if (directory.existsSync()) return path;
directory.createSync(recursive: true);
return path;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/app/services/storage_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StorageService {
late final GetStorage _storage;

Future<void> init() async {
_storage = GetStorage(AppData.appName, await FileService.to.dbDirectory);
_storage = GetStorage(AppData.appName, FileService.to.dbDirectory);
await _storage.initStorage;
}

Expand Down

0 comments on commit e980397

Please sign in to comment.