fix(platform): Make platform storage path nullable for compability with previous behaviour

pull/240/head
NaiJi ✨ 2023-07-20 17:14:17 -03:00
parent 25d6881837
commit 3b1eee5a94
1 changed files with 5 additions and 5 deletions

View File

@ -6,14 +6,14 @@ import 'package:flutter/foundation.dart';
/// SelfPrivacy wrapper for Platform information provider.
class PlatformAdapter {
/// Persistent storage directory for data files.
static String get storagePath {
String path = '.';
static String? get storagePath {
String? path;
if (Platform.isLinux) {
// https://wiki.archlinux.org/title/XDG_Base_Directory
path = Platform.environment['XDG_DATA_HOME'] ?? '.';
if (path == '.') {
path = Platform.environment['XDG_DATA_HOME'];
if (path == null) {
final String home = Platform.environment['HOME'] ?? '.';
path += '$home/.local/share';
path = '$home/.local/share';
}
path += '/selfprivacy';
}