Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@
"yargs": "^17.7.2"
},
"browserslist": "cover 100%,not android < 5"
}
}
3 changes: 2 additions & 1 deletion src/lang/ar-ye.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "الأكثر تنزيلًا",
"newly_added": "أضاف حديثا",
"top_rated": "أعلى تصنيف"
"top_rated": "أعلى تصنيف",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/be-by.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/bn-bd.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/cs-cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verifizierter Herausgeber",
"most_downloaded": "Meist Heruntergeladene",
"newly_added": "Neu Hinzugefügte",
"top_rated": "Am besten Bewertete"
"top_rated": "Am besten Bewertete",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/es-sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Publicador verificado",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/fr-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/hi-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,6 @@
"verified publisher": "सत्यापित प्रकाशक",
"most_downloaded": "सर्वाधिक डाउनलोड",
"newly_added": "नया नया़ा",
"top_rated": "टॉप रेटेड"
"top_rated": "टॉप रेटेड",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/hu-hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/id-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/ir-fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/it-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/ja-jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "検証済み発行者",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/ko-kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "대부분의 다운로드",
"newly_added": "새로 추가되었습니다",
"top_rated": "최고 평점"
"top_rated": "최고 평점",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/ml-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "പരിശോധിച്ച പ്രസാധകൻ",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/mm-unicode.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/mm-zawgyi.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/pl-pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Zweryfikowany wydawca",
"most_downloaded": "Najczęściej pobierane",
"newly_added": "Ostatnio dodane",
"top_rated": "Najwyżej oceniane"
"top_rated": "Najwyżej oceniane",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/pu-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/ru-ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,6 @@
"verified publisher": "Проверенный издатель",
"most_downloaded": "Популярные",
"newly_added": "Новые",
"top_rated": "С высокой оценкой"
"top_rated": "С высокой оценкой",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/tl-ph.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/tr-tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/uk-ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/uz-uz.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "Verified publisher",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/vi-vn.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,6 @@
"verified publisher": "Nhà phát hành đã xác minh",
"most_downloaded": "Tải xuống nhiều nhất",
"newly_added": "Mới được thêm vào",
"top_rated": "Đánh giá cao nhất"
"top_rated": "Đánh giá cao nhất",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "已认证发布者",
"most_downloaded": "最多下载",
"newly_added": "最近上架",
"top_rated": "最多好评"
"top_rated": "最多好评",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "已認證發布者",
"most_downloaded": "最多下載",
"newly_added": "最近上架",
"top_rated": "最多好評"
"top_rated": "最多好評",
"rename not supported": "Rename on termux dir isn't supported"
}
3 changes: 2 additions & 1 deletion src/lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,6 @@
"verified publisher": "已驗證的發行者",
"most_downloaded": "Most Downloaded",
"newly_added": "Newly Added",
"top_rated": "Top Rated"
"top_rated": "Top Rated",
"rename not supported": "Rename on termux dir isn't supported"
}
32 changes: 31 additions & 1 deletion src/lib/openFolder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collapsableList from "components/collapsableList";
import Sidebar from "components/sidebar";
import tile from "components/tile";
import alert from "dialogs/alert";
import confirm from "dialogs/confirm";
import prompt from "dialogs/prompt";
import select from "dialogs/select";
Expand Down Expand Up @@ -350,15 +351,40 @@ function execOperation(type, action, url, $target, name) {
const confirmation = await confirm(strings.warning, msg);
if (!confirmation) return;
startLoading();
await fsOperation(url).delete();
if (!(await fsOperation(url).exists())) return;
// await fsOperation(url).delete();
recents.removeFile(url);
if (helpers.isFile(type)) {
await fsOperation(url).delete();
$target.remove();
const file = editorManager.getFile(url, "uri");
if (file) file.uri = null;
editorManager.onupdate("delete-file");
editorManager.emit("update", "delete-file");
} else {
if (url.startsWith("content://com.termux.documents/tree/")) {
const fs = fsOperation(url);
const entries = await fs.lsDir();
if (entries.length === 0) {
await fs.delete();
} else {
const deleteRecursively = async (currentUrl) => {
const currentFs = fsOperation(currentUrl);
const currentEntries = await currentFs.lsDir();
for (const entry of currentEntries) {
if (entry.isDirectory) {
await deleteRecursively(entry.url);
} else {
await fsOperation(entry.url).delete();
}
}
await currentFs.delete();
};
await deleteRecursively(url);
}
} else {
await fsOperation(url).delete();
}
recents.removeFolder(url);
helpers.updateUriOfAllActiveFiles(url, null);
$target.parentElement.remove();
Expand All @@ -371,6 +397,10 @@ function execOperation(type, action, url, $target, name) {
}

async function renameFile() {
if (url.startsWith("content://com.termux.documents/tree/")) {
alert(strings.warning, strings["rename not supported"]);
return;
}
let newName = await prompt(strings.rename, name, "text", {
match: constants.FILE_NAME_REGEX,
required: true,
Expand Down
37 changes: 32 additions & 5 deletions src/pages/fileBrowser/fileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "./fileBrowser.scss";
import Contextmenu from "components/contextmenu";
import Page from "components/page";
import searchBar from "components/searchbar";
import alert from "dialogs/alert";
import confirm from "dialogs/confirm";
import loader from "dialogs/loader";
import prompt from "dialogs/prompt";
Expand Down Expand Up @@ -447,6 +448,10 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
}

async function renameFile(newname) {
if (url.startsWith("content://com.termux.documents/tree/")) {
alert(strings.warning, strings["rename not supported"]);
return;
}
const fs = fsOperation(url);
try {
const newUrl = await fs.renameTo(newname);
Expand All @@ -468,18 +473,40 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {

async function removeFile() {
try {
const fs = fsOperation(url);
await fs.delete();
recents.removeFile(url);
openFolder.removeItem(url);

if (helpers.isDir(type)) {
if (url.startsWith("content://com.termux.documents/tree/")) {
const fs = fsOperation(url);
const entries = await fs.lsDir();
if (entries.length === 0) {
await fs.delete();
} else {
const deleteRecursively = async (currentUrl) => {
const currentFs = fsOperation(currentUrl);
const currentEntries = await currentFs.lsDir();
for (const entry of currentEntries) {
if (entry.isDirectory) {
await deleteRecursively(entry.url);
} else {
await fsOperation(entry.url).delete();
}
}
await currentFs.delete();
};
await deleteRecursively(url);
}
} else {
await fsOperation(url).delete();
}
helpers.updateUriOfAllActiveFiles(url);
recents.removeFolder(url);
} else {
const fs = fsOperation(url);
await fs.delete();
const openedFile = editorManager.getFile(url, "uri");
if (openedFile) openedFile.uri = null;
}
recents.removeFile(url);
openFolder.removeItem(url);
toast(strings.success);
delete cachedDir[url];
reload();
Expand Down