Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

join() doesn't support network shares #132

Open
bhamon opened this issue Mar 9, 2015 · 4 comments
Open

join() doesn't support network shares #132

bhamon opened this issue Mar 9, 2015 · 4 comments

Comments

@bhamon
Copy link

bhamon commented Mar 9, 2015

The two following calls doesn't return the same value :

console.log(require('fs').join('\\\\path', 'to', 'sharedFolder')); // \\path\to\sharedFolder
console.log(require('q-io/fs').join('\\\\path', 'to', 'sharedFolder')); // path\to\sharedFolder

Thus, the following call fails with a ENOENT error :

require('q-io/fs').removeTree('\\\\path\\to\\sharedFolder')
//...
@bhamon
Copy link
Author

bhamon commented Apr 1, 2015

For information, I use the following snippet to correct this issue in the meantime:

// PATCH: corrects the q-io opened issue #132
lib.qIo.fs.join = function() {
    var args = [];
    Array.prototype.slice.call(arguments, 0).forEach(function(p_arg) {
        if(Array.isArray(p_arg)) {
            Array.prototype.push.apply(args, p_arg);
        } else {
            args.push(p_arg);
        }
    });

    return lib.node.path.join.apply(null, args);
};
// PATCH

@kriskowal
Copy link
Owner

Let me know if there is anything I can do to enable you to resolve this issue. I’ve had conversations with @Stuk about the eccentricities of my interpretation of path manipulation, which go back to working with @tlrobinson on Narwhal’s. I am open to an overhaul of this interface in the v2 branch, and would be happy to accept backward-compatible (and test-passing) changes on v1. I am open to bringing you on as a contributor or publisher if that is helpful to you.

@bhamon
Copy link
Author

bhamon commented Apr 28, 2015

It could be a good idea to reuse the NodeJS path module for path manipulation in your whole library. I'll look for all the impacts that this solution brings when I have some free time and keep you in touch.

@kriskowal
Copy link
Owner

@bhamon It may well be. That is on the table for q-io v2 even if it introduces backward incompatibility. The intent with q-io is that the file system object should host its own path manipulation methods with behavior according to the underlying file system, but that might not be in the cards. One thing that it does not yet take into account, that seldom anyone takes into account, is that Windows tracks a separate working directory for each drive. What we have is far from perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants