tdweb: minor

GitOrigin-RevId: a5195050ce00490a930f4e75142995fa26260b4e
This commit is contained in:
Arseny Smirnov 2019-04-13 23:43:29 +03:00
parent 67c9d568ae
commit bc13613a24
2 changed files with 20 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@arseny30/tdweb",
"version": "0.2.39",
"version": "0.2.40",
"description": "Javascript interface for TDLib (telegram library)",
"main": "dist/tdweb.js",
"files": [

View File

@ -245,8 +245,13 @@ class DbFileSystem {
});
let rmrf = (path) => {
log.debug("rmrf ", path);
let info = FS.lookupPath(path);
log.debug("rmrf " , path);
var info;
try {
info = FS.lookupPath(path);
} catch (e) {
return;
}
log.debug("rmrf " , path, info);
if (info.node.isFolder) {
for (var key in info.node.contents) {
@ -259,9 +264,19 @@ class DbFileSystem {
FS.unlink(path);
}
};
var dirs = ['thumbnails', 'profile_photos', 'secret', 'stickers', 'temp', 'wallpapers', 'secret_thumbnails', 'passport'];
//var dirs = ['thumbnails', 'profile_photos', 'secret', 'stickers', 'temp', 'wallpapers', 'secret_thumbnails', 'passport'];
var dirs = [];
let root_dir = FS.lookupPath(root);
for (var key in root_dir.node.contents) {
let value = root_dir.node.contents[key];
log.debug("node " , key, value);
if (!value.isFolder) {
continue;
}
dirs.push(root_dir.path + '/' + value.name)
}
for (let i in dirs) {
let dir = root + '/' + dirs[i];
let dir = dirs[i];
rmrf(dir)
//FS.mkdir(dir);
//FS.mount(FS.filesystems.MEMFS, {}, dir);