summaryrefslogtreecommitdiff
path: root/lib/path.js
AgeCommit message (Collapse)Author
2015-01-21lib: use const to define constantscjihrig
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: https://github.com/iojs/io.js/pull/541 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-12-09path: refactor normalizeArray()Nathan Woltman
The normalizeArray() function now avoids using the slow Array#splice() method to improve performance and now also filters out empty path parts. Code that pre-filtered empty parts has been removed. PR-URL: https://github.com/joyent/node/pull/8724 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-12-08path: path.normalize no longer lower-cases drive lettersBert Belder
Fixes an omission in e24fa83.
2014-12-08Revert "path: resolve normalize drive letter to lower case"Nikolai Vavilov
This reverts commit f6e574018090ed4d63596b8a3bb614f8f48b6267. Changing drive letters to lowercase violates the principle of least surprise. Other functions that do this should get fixed too. Conflicts: lib/path.js PR-URL: https://github.com/iojs/io.js/pull/100 Reviewed-By: Bert Belder <bertbelder@gmail.com>
2014-11-22Merge remote-tracking branch 'joyent/v0.12' into v0.12Ben Noordhuis
Conflicts: Makefile deps/v8/src/base/platform/platform.h PR-URL: https://github.com/node-forward/node/pull/65 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2014-11-22lib: turn on strict modeBen Noordhuis
Turn on strict mode for the files in the lib/ directory. It helps catch bugs and can have a positive effect on performance. PR-URL: https://github.com/node-forward/node/pull/64 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-11-20path: added parse() and format() functionsRory Bradford
The parse() function splits a path and returns an object with the different elements. The format() function is the reverse of this and adds an objects corresponding path elements to make up a string. Fixes #6976. Fixes: https://github.com/joyent/node/issues/6976 PR-URL: https://github.com/joyent/node/pull/8750 Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
2014-11-20path: allow calling platform specific methodsTimothy J Fontaine
Add path.posix and path.win32 which have the specific methods like resolve and normalize so you can specifically normalize or resolve based on the target platform. PR-URL: https://github.com/joyent/node/pull/5661 Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-10-25lint: fix whitespace issuesTrevor Norris
Fixes: f6e5740 "path: resolve normalize drive letter to lower case" Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-10-20path: resolve normalize drive letter to lower casedead-horse
make path.resolve work the same as path.normalize
2014-08-04path: isAbsolute() should always return booleanHerman Lee
On Windows, path.isAbsolute() returns an empty string on failed cases. This forces the return value to always be boolean. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-02path: fix slice OOB in trimLucio M. Tato
Internal function trim(arr). 2nd parameter of slice() should be slice's end index (not included). Because of function normalize() (called before trim()), "start" is always zero so the bug -for now- has no effect, but its a bug waiting to happen. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-01-21path: improve POSIX path.join() performanceJo Liss
Performance gains are ~4x (~1.5us), but still much slower than a naive approach. There is some duplicate work done between join(), normalize() and normalizeArray() so additional optimizations are possible. Note that this only improves the POSIX implementation. Thanks to @isaacs and @othiym23 for helping with this optimization. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2013-08-01src: Replace macros with util functionsisaacs
2013-07-24lib: macro-ify type checksBen Noordhuis
Increases the grep factor. Makes it easier to harmonize type checks across the code base.
2013-04-19path: add path.isAbsolute(path)Ryan Doenges
An absolute path will always open the same location regardless of your current working directory. For posix, this just means path.charAt(0) === '/', but on Windows it's a little more complicated. Fixes joyent/node#5299.
2013-03-19test: Misc Windows unit test fixesScott Blomquist
Fixes #5071, #5073. * Normalize capitalization of drive letter * Fix `exit()` typo in failure path * Ignore symlink tests (Windows) if not elevated The `test_relative_input_cwd()` test was failing on Windows when `skipSymlinks` was `true`. So we won't run it if `skipSymlinks` is `true`. When it failed, the unhandled error caused Node to die before having a chance to clean up, which resulted in two files missing in subsequent unit tests: * `test/fixtures/nested-index/one/hello.js` * `test/fixtures/nested-index/one/index.js` We should probably find a way to isolate this test from the other test (`simple/test-module-loading`) that was failing when this test poluted the disk state.
2013-02-22lintisaacs
2013-02-21path: Throw TypeError on non-string args to path.resolveisaacs
2013-02-21path: join throws TypeError on non-string argsArianit Uka
lib/path.js: - throws a TypeError on the filter if the argument is not a string. test/simple/test-path.js: - removed the test to check if non-string types are filtered. - added a test to check if path.join throws TypeError on arguments that are not strings.
2013-02-20path: Do not coerce paths to strings on Windowsisaacs
Fix #4795
2013-01-11path: make basename and extname ignore trailing slashesBert Belder
Fixes #4536
2013-01-11Revert "path: fix bugs related to paths with trailing slashes"Bert Belder
It only does the right thing on unix, and the implementation isn't great either. This reverts commit bb1c03989f8702e06072e6d9228b52661bf00ace.
2013-01-10path: fix bugs related to paths with trailing slashesAndreas Madsen
2012-12-07lintisaacs
introduced in 5b65638.
2012-11-21windows: fix normalization of UNC pathsBert Belder
2012-10-01path: add platform specific path delimiterPaul Serby
Closes #3728 Closes #4071
2012-08-27lintisaacs
2012-08-10path: small speed improvementsFelix Böhm
2012-06-21Add --no-deprecation and --trace-deprecation flagsisaacs
2012-05-15Merge remote-tracking branch 'ry/v0.6' into v0.6-mergeisaacs
Conflicts: ChangeLog deps/uv/include/uv-private/uv-unix.h deps/uv/src/unix/core.c deps/uv/src/unix/sunos.c deps/v8/src/runtime.cc doc/api/crypto.markdown lib/http.js src/node_version.h test/gc/test-http-client-timeout.js wscript
2012-05-13Windows: make path.normalize convert all slashes to backslashesBert Belder
Closes #3066
2012-05-01path: add path.sep to get the path separator.Yi, EungJun
2012-02-18Lint all the JavaScripts.isaacs
2012-02-18Merge remote-tracking branch 'ry/v0.6' into v0.6-mergeisaacs
Conflicts: AUTHORS ChangeLog Makefile doc/about/index.html doc/api/tls.markdown doc/community/index.html doc/index.html doc/logos/index.html doc/template.html lib/http.js lib/tls.js src/node_version.h src/platform_win32.cc test/simple/test-tls-connect-given-socket.js
2012-02-16Windows: get rid of process._cwdForDrive()Bert Belder
2012-02-06Merge remote-tracking branch 'ry/v0.6'isaacs
Conflicts: ChangeLog deps/v8/src/version.cc deps/v8/tools/gyp/v8.gyp doc/about/index.html doc/community/index.html doc/index.html doc/logos/index.html doc/template.html lib/path.js lib/querystring.js src/node_version.h
2012-02-02_makeLong shouldn't turn the empty string into \\?\C:\Bert Belder
2012-02-02Run path.exists paths through _makeLongBert Belder
2012-01-30core: add `NativeModule.prototype.deprecate`Brandon Benvie
Formalize and cleanup handling of deprecated core methods.
2012-01-24Merge branch 'v0.6'Fedor Indutny
Conflicts: ChangeLog doc/template.html lib/cluster.js lib/http.js lib/tls.js src/node.h src/node_version.h test/simple/test-cluster-kill-workers.js
2012-01-21path fs: move `path.exists*` to `fs.exists*`Maciej Małecki
`path.exists*` functions show a deprecation warning and call functions from `fs`. They should be removed later. test: fix references to `path.exists*` in tests test fs: add test for `fs.exists` and `fs.existsSync` doc: reflect moving `path.exists*` to `fs`
2012-01-18Make path.extname do the right thing when the last path component is . or ..Bert Belder
Closes GH-2526
2011-12-20Remove unnecessary statementBert Belder
2011-11-25Enable long paths on windowsAuthor: Igor Zinkovsky
2011-11-24Windows: correctly resolve drive-relative pathsBert Belder
2011-10-05Fixed a lot of jslint errors.Colton Baker
Fixes #1831
2011-09-06Improve path parsing on windowsBert Belder
Closes #650
2011-08-14path.js: correct three harmless .length typosThomas Shinnick
lib/path.js routines normalizeArray() and resolve() have for loops that count down from end of an array. The loop indexes are initialized using "array.length" rather than "array.length-1". The initial array element accessed is always beyond the end of array and the value is 'undefined'. Strangely, code exists that acts to ignore undefined values so that the typos are unnoticeable. Existing tests emit no errors either before or after changing to "length-1". Tests _do_ start failing at "length-2". (Actually it is node that starts to fail at "length-2" - that's a valid enough test...)