Skip to content

Commit 9790134

Browse files
committed
Ensure dirs + resolv.conf exist before every proot operation (#40)
getProotShellConfig() is called by all screens before starting proot (terminal, configure, onboarding, package install). Adding setupDirs and writeResolv here guarantees resolv.conf exists regardless of which screen the user opens first after an app update. Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
1 parent 7e84839 commit 9790134

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

flutter_app/lib/services/terminal_service.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ class TerminalService {
1414
/// Get paths and host-side proot environment variables.
1515
/// Host env should ONLY contain proot-specific vars — guest env is
1616
/// set via `env -i` inside the command, matching proot-distro.
17+
///
18+
/// Also ensures directories and resolv.conf exist — Android may clear
19+
/// them during an app update (#40). Every screen that uses proot calls
20+
/// this method, so it's the single place to guarantee the files exist.
1721
static Future<Map<String, String>> getProotShellConfig() async {
22+
// Ensure dirs + resolv.conf exist before any proot operation (#40).
23+
try { await NativeBridge.setupDirs(); } catch (_) {}
24+
try { await NativeBridge.writeResolv(); } catch (_) {}
25+
1826
final filesDir = await _channel.invokeMethod<String>('getFilesDir') ?? '';
1927
final nativeLibDir = await _channel.invokeMethod<String>('getNativeLibDir') ?? '';
2028

0 commit comments

Comments
 (0)