Skip to content

Commit

Permalink
add mounting local filesystems from fsapp
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Feb 28, 2024
1 parent be735b9 commit 21b3ded
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/fsapp.app/filemanager.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
<i class="material-symbols-outlined">history</i>Recent
</button>
<hr />
<button>
<button onclick="loadPath('/')">
<i class="material-symbols-outlined">laptop_chromebook</i>My files
</button>
<button onclick="mountLocalFs()">
<i class="material-symbols-outlined">usb</i>Mount local drive
</button>
</div>
<div class="fileView">
<div class="topbar">
Expand Down
12 changes: 12 additions & 0 deletions apps/fsapp.app/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ window.fs = anura.fs;
window.Buffer = Filer.Buffer;
let sh = new anura.fs.Shell();

async function mountLocalFs() {
let path = prompt("Enter the path where you want to mount the local filesystem")
if (!path.startsWith("/")) {
anura.notifications.add( {
title: "File Manager",
description: "Path does not start with a \"/\" character",
timeout: 5000,
});
return;
}
await LocalFS.new(path)
}
function loadPath(path) {
console.debug("loading path: ", path);
fs.readdir(path + "/", (err, files) => {
Expand Down
1 change: 1 addition & 0 deletions src/coreapps/ExternalApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ExternalApp extends App {
anura,
AliceWM,
ExternalApp,
LocalFS,
instance: this,
instanceWindow: win,
h,
Expand Down

0 comments on commit 21b3ded

Please sign in to comment.