Skip to content

Commit

Permalink
Fix file permissions in a snap
Browse files Browse the repository at this point in the history
  • Loading branch information
ashuntu committed Aug 27, 2024
1 parent 03e1498 commit 284ddb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/game_center/lib/steam/steam_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class SteamModel extends _$SteamModel {
Future<Config> build({String? install}) async {
// default install location
if (install == null) {
final home = Platform.environment['HOME'];
final home = Platform.environment['SNAP_REAL_HOME'] ??
Platform.environment['HOME'];
if (home == null) {
throw StateError('\$HOME not found.');
throw StateError('Home directory not found.');
}
install = '$home/snap/steam/common';
}
Expand Down Expand Up @@ -131,8 +132,8 @@ class SteamModel extends _$SteamModel {
/// Get a map of installed Steam apps for the given user.
Future<Map<String, dynamic>> listApps({required String steamID}) async {
Map<String, dynamic> config = Map.from(userConfigs[steamID]!);
Map<dynamic, dynamic> apps =
config['UserLocalConfigStore']['Software']['Valve']['Steam']['apps'];
var apps = config['UserLocalConfigStore']['Software']['Valve']['Steam']
['apps'] as Map;
return apps.cast<String, dynamic>();
}

Expand Down
7 changes: 7 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ apps:
plugs:
- desktop
- desktop-legacy
- home

plugs:
steam-snap:
interface: personal-files
write:
- $HOME/snap/steam

parts:
flutter-git:
Expand Down

0 comments on commit 284ddb9

Please sign in to comment.