SFTP init.

This commit is contained in:
Junyuan Feng
2022-02-18 13:32:50 +08:00
parent 282e61afac
commit f07d33a1d6
7 changed files with 176 additions and 93 deletions

View File

@@ -0,0 +1,29 @@
class AbsolutePath {
String path;
String? _prePath;
AbsolutePath(this.path);
void update(String newPath) {
_prePath = path;
if (newPath == '..') {
path = path.substring(0, path.lastIndexOf('/'));
if (path == '') {
path = '/';
}
return;
}
if (newPath == '/') {
path = '/';
return;
}
path = path + (path.endsWith('/') ? '' : '/') + newPath;
}
bool undo() {
if (_prePath == null) {
return false;
}
path = _prePath!;
return true;
}
}