Skip to content

Commit

Permalink
Fix renaming with files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernthedev committed Nov 23, 2023
1 parent 66bbd3c commit 4ac5f40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/pages/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ class _DeviceBrowserPageState extends State<DeviceBrowserPage> {
}

void _onNavigate(String newPath) {
if (!context.mounted) return;

Trace.verbose("Loading $newPath");
// final token = ServicesBinding.rootIsolateToken;
// var future = compute((message) {
Expand Down
10 changes: 5 additions & 5 deletions lib/utils/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ abstract class Adb {
static String fixPath(String path, {bool addQuotes = true}) {
if (!path.startsWith("/")) path = "/$path";

if (!addQuotes) {
return path;
if (addQuotes) {
path = "\"$path\"";
}
return "\"$path\"";
return path;

// return path
// .replaceAll('\\', '/')
Expand Down Expand Up @@ -324,8 +324,8 @@ drwxrwx--x 2 u0_a140 sdcard_rw 3488 2023-11-01 10:45 mods_old

static Future<String> moveFile(
String? serialName, String source, String dest) async {
source = fixPath(source, addQuotes: false);
dest = fixPath(dest, addQuotes: false);
source = fixPath(source, addQuotes: true);
dest = fixPath(dest, addQuotes: true);
var result = await runAdbCommand(serialName, ["shell", "mv", source, dest]);

return normalizeOutput(result.stdout);
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/browser/file_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class _DataRowState extends State<DataRow> {
e.friendlyFileName,
overflow: TextOverflow.ellipsis,
);

return Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Expand Down Expand Up @@ -354,9 +354,9 @@ class _DataRowState extends State<DataRow> {

// False positive
// ignore: use_build_context_synchronously
fileData.browser.refresh();
if (!context.mounted) return;
Navigator.of(context).pop();
fileData.browser.refresh();
},
),
],
Expand Down

0 comments on commit 4ac5f40

Please sign in to comment.