mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-06 16:14:15 +00:00
fix(platform): Make platform storage path nullable for compability with previous behaviour
This commit is contained in:
parent
25d6881837
commit
3b1eee5a94
|
@ -6,14 +6,14 @@ import 'package:flutter/foundation.dart';
|
||||||
/// SelfPrivacy wrapper for Platform information provider.
|
/// SelfPrivacy wrapper for Platform information provider.
|
||||||
class PlatformAdapter {
|
class PlatformAdapter {
|
||||||
/// Persistent storage directory for data files.
|
/// Persistent storage directory for data files.
|
||||||
static String get storagePath {
|
static String? get storagePath {
|
||||||
String path = '.';
|
String? path;
|
||||||
if (Platform.isLinux) {
|
if (Platform.isLinux) {
|
||||||
// https://wiki.archlinux.org/title/XDG_Base_Directory
|
// https://wiki.archlinux.org/title/XDG_Base_Directory
|
||||||
path = Platform.environment['XDG_DATA_HOME'] ?? '.';
|
path = Platform.environment['XDG_DATA_HOME'];
|
||||||
if (path == '.') {
|
if (path == null) {
|
||||||
final String home = Platform.environment['HOME'] ?? '.';
|
final String home = Platform.environment['HOME'] ?? '.';
|
||||||
path += '$home/.local/share';
|
path = '$home/.local/share';
|
||||||
}
|
}
|
||||||
path += '/selfprivacy';
|
path += '/selfprivacy';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue