fix android get windows parent dirname
This commit is contained in:
parent
1ab99075ce
commit
88b3144026
@ -3,7 +3,6 @@ import 'dart:convert';
|
|||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_hbb/common.dart';
|
import 'package:flutter_hbb/common.dart';
|
||||||
import 'package:flutter_hbb/pages/file_manager_page.dart';
|
import 'package:flutter_hbb/pages/file_manager_page.dart';
|
||||||
import 'package:path/path.dart' as p;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:path/path.dart' as Path;
|
import 'package:path/path.dart' as Path;
|
||||||
|
|
||||||
@ -110,6 +109,7 @@ class FileModel extends ChangeNotifier {
|
|||||||
final fd = FileDirectory.fromJson(jsonDecode(evt['value']));
|
final fd = FileDirectory.fromJson(jsonDecode(evt['value']));
|
||||||
fd.format(_remoteOption.isWindows, sort: _sortStyle);
|
fd.format(_remoteOption.isWindows, sort: _sortStyle);
|
||||||
_remoteOption.home = fd.path;
|
_remoteOption.home = fd.path;
|
||||||
|
debugPrint("init remote home:${fd.path}");
|
||||||
_currentRemoteDir = fd;
|
_currentRemoteDir = fd;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return;
|
return;
|
||||||
@ -229,7 +229,10 @@ class FileModel extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goToParentDirectory() {
|
goToParentDirectory() {
|
||||||
openDirectory(currentDir.parent);
|
final isWindows =
|
||||||
|
_isLocal ? _localOption.isWindows : _remoteOption.isWindows;
|
||||||
|
final parent = PathUtil.dirname(currentDir.path, isWindows);
|
||||||
|
openDirectory(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFiles(SelectedItems items) {
|
sendFiles(SelectedItems items) {
|
||||||
@ -574,8 +577,6 @@ class FileDirectory {
|
|||||||
int id = 0;
|
int id = 0;
|
||||||
String path = "";
|
String path = "";
|
||||||
|
|
||||||
String get parent => p.dirname(path);
|
|
||||||
|
|
||||||
FileDirectory();
|
FileDirectory();
|
||||||
|
|
||||||
FileDirectory.fromJson(Map<String, dynamic> json) {
|
FileDirectory.fromJson(Map<String, dynamic> json) {
|
||||||
@ -670,6 +671,11 @@ class PathUtil {
|
|||||||
final pathUtil = isWindows ? windowsContext : posixContext;
|
final pathUtil = isWindows ? windowsContext : posixContext;
|
||||||
return pathUtil.split(path);
|
return pathUtil.split(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String dirname(String path, bool isWindows){
|
||||||
|
final pathUtil = isWindows ? windowsContext : posixContext;
|
||||||
|
return pathUtil.dirname(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectoryOption {
|
class DirectoryOption {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user