opt.: sftp home & back (#533)
This commit is contained in:
@@ -2,12 +2,14 @@ import 'package:fl_lib/fl_lib.dart';
|
||||
|
||||
class AbsolutePath {
|
||||
String _path;
|
||||
final _prePath = <String>[];
|
||||
|
||||
AbsolutePath(this._path);
|
||||
|
||||
String get path => _path;
|
||||
final List<String> _prePath;
|
||||
|
||||
AbsolutePath(this._path) : _prePath = ['/'];
|
||||
|
||||
void update(String newPath) {
|
||||
/// Update path, not set path
|
||||
set path(String newPath) {
|
||||
_prePath.add(_path);
|
||||
if (newPath == '..') {
|
||||
_path = _path.substring(0, _path.lastIndexOf('/'));
|
||||
@@ -16,10 +18,6 @@ class AbsolutePath {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (newPath == '/') {
|
||||
_path = '/';
|
||||
return;
|
||||
}
|
||||
if (newPath.startsWith('/')) {
|
||||
_path = newPath;
|
||||
return;
|
||||
|
||||
@@ -2,9 +2,11 @@ import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:server_box/data/model/sftp/absolute_path.dart';
|
||||
|
||||
class SftpBrowserStatus {
|
||||
List<SftpName>? files;
|
||||
AbsolutePath? path;
|
||||
final List<SftpName> files = [];
|
||||
final AbsolutePath path = AbsolutePath('/');
|
||||
SftpClient? client;
|
||||
|
||||
SftpBrowserStatus();
|
||||
SftpBrowserStatus(SSHClient client) {
|
||||
client.sftp().then((value) => this.client = value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user