Merge pull request #3676 from Heap-Hop/master
fix remote DirectoryOptions isWindows initialization failure
This commit is contained in:
commit
ac16602f6b
@ -8,6 +8,7 @@ import 'package:flutter_hbb/utils/event_loop.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
|
import '../consts.dart';
|
||||||
import 'model.dart';
|
import 'model.dart';
|
||||||
import 'platform_model.dart';
|
import 'platform_model.dart';
|
||||||
|
|
||||||
@ -54,14 +55,14 @@ class FileModel {
|
|||||||
localController = FileController(
|
localController = FileController(
|
||||||
isLocal: true,
|
isLocal: true,
|
||||||
getSessionID: getSessionID,
|
getSessionID: getSessionID,
|
||||||
dialogManager: parent.target?.dialogManager,
|
rootState: parent,
|
||||||
jobController: jobController,
|
jobController: jobController,
|
||||||
fileFetcher: fileFetcher,
|
fileFetcher: fileFetcher,
|
||||||
getOtherSideDirectoryData: () => remoteController.directoryData());
|
getOtherSideDirectoryData: () => remoteController.directoryData());
|
||||||
remoteController = FileController(
|
remoteController = FileController(
|
||||||
isLocal: false,
|
isLocal: false,
|
||||||
getSessionID: getSessionID,
|
getSessionID: getSessionID,
|
||||||
dialogManager: parent.target?.dialogManager,
|
rootState: parent,
|
||||||
jobController: jobController,
|
jobController: jobController,
|
||||||
fileFetcher: fileFetcher,
|
fileFetcher: fileFetcher,
|
||||||
getOtherSideDirectoryData: () => localController.directoryData());
|
getOtherSideDirectoryData: () => localController.directoryData());
|
||||||
@ -246,7 +247,7 @@ class FileController {
|
|||||||
final sortBy = SortBy.name.obs;
|
final sortBy = SortBy.name.obs;
|
||||||
var sortAscending = true;
|
var sortAscending = true;
|
||||||
final JobController jobController;
|
final JobController jobController;
|
||||||
final OverlayDialogManager? dialogManager;
|
final WeakReference<FFI> rootState;
|
||||||
|
|
||||||
final DirectoryData Function() getOtherSideDirectoryData;
|
final DirectoryData Function() getOtherSideDirectoryData;
|
||||||
late final SelectedItems selectedItems = SelectedItems(isLocal: isLocal);
|
late final SelectedItems selectedItems = SelectedItems(isLocal: isLocal);
|
||||||
@ -254,12 +255,13 @@ class FileController {
|
|||||||
FileController(
|
FileController(
|
||||||
{required this.isLocal,
|
{required this.isLocal,
|
||||||
required this.getSessionID,
|
required this.getSessionID,
|
||||||
required this.dialogManager,
|
required this.rootState,
|
||||||
required this.jobController,
|
required this.jobController,
|
||||||
required this.fileFetcher,
|
required this.fileFetcher,
|
||||||
required this.getOtherSideDirectoryData});
|
required this.getOtherSideDirectoryData});
|
||||||
|
|
||||||
String get homePath => options.value.home;
|
String get homePath => options.value.home;
|
||||||
|
OverlayDialogManager? get dialogManager => rootState.target?.dialogManager;
|
||||||
|
|
||||||
String get shortPath {
|
String get shortPath {
|
||||||
final dirPath = directory.value.path;
|
final dirPath = directory.value.path;
|
||||||
@ -286,7 +288,9 @@ class FileController {
|
|||||||
id: sessionID,
|
id: sessionID,
|
||||||
name: isLocal ? "local_show_hidden" : "remote_show_hidden"))
|
name: isLocal ? "local_show_hidden" : "remote_show_hidden"))
|
||||||
.isNotEmpty;
|
.isNotEmpty;
|
||||||
options.value.isWindows = Platform.isWindows;
|
options.value.isWindows = isLocal
|
||||||
|
? Platform.isWindows
|
||||||
|
: rootState.target?.ffiModel.pi.platform == kPeerPlatformWindows;
|
||||||
|
|
||||||
await Future.delayed(Duration(milliseconds: 100));
|
await Future.delayed(Duration(milliseconds: 100));
|
||||||
|
|
||||||
@ -475,7 +479,7 @@ class FileController {
|
|||||||
title = translate("Not an empty directory");
|
title = translate("Not an empty directory");
|
||||||
dialogManager?.showLoading(translate("Waiting"));
|
dialogManager?.showLoading(translate("Waiting"));
|
||||||
final fd = await fileFetcher.fetchDirectoryRecursive(
|
final fd = await fileFetcher.fetchDirectoryRecursive(
|
||||||
jobID, item.path, items.isLocal!, true);
|
jobID, item.path, items.isLocal, true);
|
||||||
if (fd.path.isEmpty) {
|
if (fd.path.isEmpty) {
|
||||||
fd.path = item.path;
|
fd.path = item.path;
|
||||||
}
|
}
|
||||||
@ -890,12 +894,12 @@ class FileFetcher {
|
|||||||
try {
|
try {
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
final res = await bind.sessionReadLocalDirSync(
|
final res = await bind.sessionReadLocalDirSync(
|
||||||
id: sessionID ?? "", path: path, showHidden: showHidden);
|
id: sessionID, path: path, showHidden: showHidden);
|
||||||
final fd = FileDirectory.fromJson(jsonDecode(res));
|
final fd = FileDirectory.fromJson(jsonDecode(res));
|
||||||
return fd;
|
return fd;
|
||||||
} else {
|
} else {
|
||||||
await bind.sessionReadRemoteDir(
|
await bind.sessionReadRemoteDir(
|
||||||
id: sessionID ?? "", path: path, includeHidden: showHidden);
|
id: sessionID, path: path, includeHidden: showHidden);
|
||||||
return registerReadTask(isLocal, path);
|
return registerReadTask(isLocal, path);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user