fix: support emptry folder transfer for web (#10151)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
34d2c62781
commit
e6edf39305
@ -261,6 +261,27 @@ class FileModel {
|
|||||||
debugPrint("Failed to decode onSelectedFiles: $e");
|
debugPrint("Failed to decode onSelectedFiles: $e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendEmptyDirs(dynamic obj) {
|
||||||
|
late final List<dynamic> emptyDirs;
|
||||||
|
try {
|
||||||
|
emptyDirs = jsonDecode(obj['dirs'] as String);
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint("Failed to decode sendEmptyDirs: $e");
|
||||||
|
}
|
||||||
|
final otherSideData = remoteController.directoryData();
|
||||||
|
final toPath = otherSideData.directory.path;
|
||||||
|
final isPeerWindows = otherSideData.options.isWindows;
|
||||||
|
|
||||||
|
final isLocalWindows = isWindows || isWebOnWindows;
|
||||||
|
for (var dir in emptyDirs) {
|
||||||
|
if (isLocalWindows != isPeerWindows) {
|
||||||
|
dir = PathUtil.convert(dir, isLocalWindows, isPeerWindows);
|
||||||
|
}
|
||||||
|
var peerPath = PathUtil.join(toPath, dir, isPeerWindows);
|
||||||
|
remoteController.createDirWithRemote(peerPath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectoryData {
|
class DirectoryData {
|
||||||
@ -502,8 +523,9 @@ class FileController {
|
|||||||
"path: ${from.path}, toPath: $toPath, to: ${PathUtil.join(toPath, from.name, isWindows)}");
|
"path: ${from.path}, toPath: $toPath, to: ${PathUtil.join(toPath, from.name, isWindows)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLocal &&
|
if (isWeb ||
|
||||||
versionCmp(rootState.target!.ffiModel.pi.version, '1.3.3') < 0) {
|
(!isLocal &&
|
||||||
|
versionCmp(rootState.target!.ffiModel.pi.version, '1.3.3') < 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,6 +1528,12 @@ class PathUtil {
|
|||||||
return pathUtil.split(path);
|
return pathUtil.split(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String convert(String path, bool isMainWindows, bool isOtherWindows) {
|
||||||
|
final mainPathUtil = isMainWindows ? windowsContext : posixContext;
|
||||||
|
final otherPathUtil = isOtherWindows ? windowsContext : posixContext;
|
||||||
|
return otherPathUtil.joinAll(mainPathUtil.split(path));
|
||||||
|
}
|
||||||
|
|
||||||
static String dirname(String path, bool isWindows) {
|
static String dirname(String path, bool isWindows) {
|
||||||
final pathUtil = isWindows ? windowsContext : posixContext;
|
final pathUtil = isWindows ? windowsContext : posixContext;
|
||||||
return pathUtil.dirname(path);
|
return pathUtil.dirname(path);
|
||||||
|
@ -402,6 +402,10 @@ class FfiModel with ChangeNotifier {
|
|||||||
if (isWeb) {
|
if (isWeb) {
|
||||||
parent.target?.fileModel.onSelectedFiles(evt);
|
parent.target?.fileModel.onSelectedFiles(evt);
|
||||||
}
|
}
|
||||||
|
} else if (name == "send_emptry_dirs") {
|
||||||
|
if (isWeb) {
|
||||||
|
parent.target?.fileModel.sendEmptyDirs(evt);
|
||||||
|
}
|
||||||
} else if (name == "record_status") {
|
} else if (name == "record_status") {
|
||||||
if (desktopType == DesktopType.remote || isMobile) {
|
if (desktopType == DesktopType.remote || isMobile) {
|
||||||
parent.target?.recordingModel.updateStatus(evt['start'] == 'true');
|
parent.target?.recordingModel.updateStatus(evt['start'] == 'true');
|
||||||
|
@ -1801,6 +1801,26 @@ class RustdeskImpl {
|
|||||||
throw UnimplementedError("mainMaxEncryptLen");
|
throw UnimplementedError("mainMaxEncryptLen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mainAudioSupportLoopback({dynamic hint}) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> sessionReadLocalEmptyDirsRecursiveSync(
|
||||||
|
{required UuidValue sessionId,
|
||||||
|
required String path,
|
||||||
|
required bool includeHidden,
|
||||||
|
dynamic hint}) {
|
||||||
|
throw UnimplementedError("sessionReadLocalEmptyDirsRecursiveSync");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> sessionReadRemoteEmptyDirsRecursiveSync(
|
||||||
|
{required UuidValue sessionId,
|
||||||
|
required String path,
|
||||||
|
required bool includeHidden,
|
||||||
|
dynamic hint}) {
|
||||||
|
throw UnimplementedError("sessionReadRemoteEmptyDirsRecursiveSync");
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> sessionRenameFile(
|
Future<void> sessionRenameFile(
|
||||||
{required UuidValue sessionId,
|
{required UuidValue sessionId,
|
||||||
required int actId,
|
required int actId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user