From 13d0ccc7569dea9877c0e8baf0fe275bf2f70323 Mon Sep 17 00:00:00 2001 From: Evan Anderson Date: Wed, 19 Apr 2023 13:16:23 -0500 Subject: [PATCH] icons: Avoid use of rename when installing icon pack rename does not work across filesystems. /tmp is often in a tmpfs filesystem, and thus installing the icon pack fails. Solve this by using a copy/delete pattern instead of rename Fixes https://github.com/Yubico/yubioath-flutter/issues/1051 --- lib/oath/icon_provider/icon_pack_manager.dart | 3 ++- pubspec.lock | 2 +- pubspec.yaml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oath/icon_provider/icon_pack_manager.dart b/lib/oath/icon_provider/icon_pack_manager.dart index 080de5ea..46982308 100644 --- a/lib/oath/icon_provider/icon_pack_manager.dart +++ b/lib/oath/icon_provider/icon_pack_manager.dart @@ -24,6 +24,7 @@ import 'package:logging/logging.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:yubico_authenticator/app/logging.dart'; +import 'package:io/io.dart'; import 'icon_cache.dart'; import 'icon_pack.dart'; @@ -166,7 +167,7 @@ class IconPackManager extends StateNotifier> { _iconCache.memCache.clear(); // moves unpacked files to the directory final directory - await unpackDirectory.rename(packDirectory.path); + await copyPath(unpackDirectory.path, packDirectory.path); readPack(); diff --git a/pubspec.lock b/pubspec.lock index 738cb842..0552d0a0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -357,7 +357,7 @@ packages: source: hosted version: "0.17.0" io: - dependency: transitive + dependency: "direct main" description: name: io sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" diff --git a/pubspec.yaml b/pubspec.yaml index 36cb7231..a87bd4bf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,6 +63,7 @@ dependencies: crypto: ^3.0.2 tray_manager: ^0.2.0 local_notifier: ^0.1.5 + io: ^1.0.4 dev_dependencies: integration_test: