On Thu, Mar 15, 2012 at 9:25 PM, Isaac Schlueter <[email protected]> wrote: > This is a great idea for a wiki page, yes. > > On Thu, Mar 15, 2012 at 12:44, Ted Young <[email protected]> wrote: >> paths - how necessary is it to use the path module? For example, is it >> necessary to use in require() statements? fs statements? > > Use path.resolve() to resolve paths and make relative paths absolute. > Do not use path.join() for this. It is not nearly as smart about > Windows paths.
Slash "/" works fine on Windows, no need to convert to backslash "\", no need to run paths for require-statements through the path-module. If only the path-module would not use backslash on windows to get rid of all those .replace(/\/, '/')-statements.. If I remember it correctly, Python uses slash within its path-transforming-libs. On PHP there is a constant (DIRECTORY_SEPARATOR), but it is a real mess. Network-paths might be an exception: \\host\path\to\whatever. But I would not be surprised if //hoist/path/to/whatever works too. >> system resources - when accessing system resources, best practices? For >> example, in python if you want to access /dev/null you can say os.devnull, >> but there currently is no node equivalent. > > I'm not sure what the best answer for /dev/null on windows is. Igor? Bert? On commandline it is: prog.exe > NUL -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
