question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting root folder problem (Windows)

See original GitHub issue

Hi,

I’m having problem setting the ftp root folder on Windows. Here is what I did :

const ftp_srv = require('ftp-srv');
const f = new ftp_srv("127.0.0.1:21", {});
f.on('login', ({ username, password }, resolveLogin, rejectLogin) => {
return resolveLogin({
                root: "d:\\ftp_root",
                cwd: "/"
            });
)};
f.listen();

When the client is getting the file (LIST) the here is what I’m getting in fs.js

class FileSystem {
  constructor(connection, {
    root = '/',
    cwd = '/'
  } = {}) {
    this.connection = connection;
    this.cwd = nodePath.resolve(cwd);              // "/" = "d:/"
    this.root = nodePath.resolve(root);            // "d:\\ftp_root" = "d:\ftp_root"
  }

Now in the list function :

  list(path = '.') {
    path = this._resolvePath(path);                // path = "d:\ftp_rootd:\"
    return fs.readdir(path)
    .then(fileNames => {

Thus, d:\ftp_rootd:\ is not a valid folder on my host. Why the cmd and the root folder are merge together ? Why not use only the root argument ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
erakiscommented, May 12, 2017

Wow, thank you so much Stewart, now it seems to work perfectly 😃

0reactions
trscommented, May 6, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing Windows Setting Security on root folder returns ...
Open Windows Explorer, right-click on the affected drive, and click Properties ->Security (tab) -> [Advanced] -> Owner (tab) -> [Edit]. You ...
Read more >
How to Locate the Root Folder for Microsoft
3. Type “echo %SYSTEMROOT%" at the command prompt and press “Enter.” The result of this search is the root folder for Microsoft Windows....
Read more >
Locate the Windows system root directory - MCCI
Enter the command “set systemroot” at the prompt, and press enter, as shown below. The system will display the system root. (The first...
Read more >
FIX: Write Access Denied on Drive C:\ - Windows Tips & How-tos
By design and for security reasons, Windows 10, 8 & Windows 7 don't allow users (even Administrators) to save files in the root...
Read more >
How to locate the system root directory in Windows - Quora
A command window should appear. Enter the command "set systemroot" at the prompt, and press enter, as shown below. The system will display...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found