diff --git a/package.json b/package.json index 75013ec..cec452f 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "inquirer": "^9.2.12", "mime-types": "^2.1.35", "nanospinner": "^1.1.0", - "fs-extra": "^11.3.0" + "fs-extra": "^11.3.0", + "fs-filesystem": "^2.1.2" } } diff --git a/src/main.js b/src/main.js index deea6a3..a65c217 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,7 @@ import { runCodex, checkNodeStatus } from './handlers/nodeHandlers.js'; import { showInfoMessage } from './utils/messages.js'; import { loadConfig } from './services/config.js'; import { showConfigMenu } from './configmenu.js'; +import {filesystemSync} from 'fs-filesystem'; async function showNavigationMenu() { console.log('\n') @@ -52,6 +53,20 @@ function handleExit() { } export async function main() { + + const result = filesystemSync(); + console.log('devices', JSON.stringify(result)); + + Object.keys(result).forEach(function(key) { + var val = result[key]; + val.volumes.forEach(function(volume) { + console.log("mounting point: " + volume.mountPoint); + }); + }); + + return; + + const commandArgs = parseCommandLineArgs(); if (commandArgs) { switch (commandArgs.command) { diff --git a/src/utils/pathSelector.js b/src/utils/pathSelector.js index fa6da7c..f962e1d 100644 --- a/src/utils/pathSelector.js +++ b/src/utils/pathSelector.js @@ -3,6 +3,7 @@ import inquirer from 'inquirer'; import boxen from 'boxen'; import chalk from 'chalk'; import fs from 'fs'; +import { filesystemSync } from 'fs-filesystem'; function showMsg(msg) { console.log(boxen(chalk.white(msg), { @@ -14,6 +15,16 @@ function showMsg(msg) { })); } +// function getAvailableRoots() { +// const platform = os.platform(); +// if (platform === 'win32') { +// const result = await runCommand('for /f "delims=" %a in (\'curl -s --ssl-reqd ip.codex.storage\') do @echo %a'); +// nat = result.trim(); +// } else { +// nat = await runCommand('curl -s https://ip.codex.storage'); +// } +// } + function splitPath(str) { return str.replaceAll("\\", "/").split("/"); } @@ -43,6 +54,15 @@ function combineWith(parts, extra) { function showCurrent(currentPath) { const len = currentPath.length; showMsg(`Current path: [${len}]\n` + combine(currentPath)); + + if (len < 2) { + showMsg( + 'Warning - Known issue:\n' + + 'Path selection does not work in root paths on some platforms.\n' + + 'Use "Enter path" or "Create new folder" to navigate and create folders\n' + + 'if this is the case for you.' + ); + } } async function showMain(currentPath) {