0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

61 Commits

Author SHA1 Message Date
dead-horse
f6e5740180 path: resolve normalize drive letter to lower case
make path.resolve work the same as path.normalize
2014-10-20 20:48:00 +02:00
Herman Lee
20229d6896 path: isAbsolute() should always return boolean
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-04 13:39:12 -07:00
Lucio M. Tato
37c2a52833 path: fix slice OOB in trim
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-08-02 00:19:20 -07:00
Jo Liss
b9bec2031e path: improve POSIX path.join() performance
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>
2014-01-21 17:00:56 -08:00
isaacs
22c68fdc1d src: Replace macros with util functions 2013-08-01 15:08:01 -07:00
Ben Noordhuis
0330bdf519 lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
2013-07-24 21:49:35 +02:00
Ryan Doenges
9026675061 path: add path.isAbsolute(path)
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-04-19 10:15:22 -07:00
Scott Blomquist
a05f973f82 test: Misc Windows unit test fixes
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-03-19 09:38:11 -07:00
isaacs
74c08403d8 lint 2013-02-22 16:30:27 -08:00
isaacs
089ec58613 path: Throw TypeError on non-string args to path.resolve 2013-02-21 15:18:44 -08:00
Arianit Uka
055110dab0 path: join throws TypeError on non-string args
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-21 11:50:47 -08:00
isaacs
bbcb8b3ae0 path: Do not coerce paths to strings on Windows
Fix #4795
2013-02-20 14:04:30 -08:00
Bert Belder
6a91eab097 path: make basename and extname ignore trailing slashes
Fixes #4536
2013-01-11 18:50:09 +01:00
Bert Belder
7be27240b5 Revert "path: fix bugs related to paths with trailing slashes"
It only does the right thing on unix, and the implementation
isn't great either.

This reverts commit bb1c03989f.
2013-01-11 16:19:21 +01:00
Andreas Madsen
bb1c03989f path: fix bugs related to paths with trailing slashes 2013-01-10 17:58:37 -08:00
isaacs
0e95ea42ce lint
introduced in 5b65638.
2012-12-07 16:58:16 -08:00
Bert Belder
bc9388342f windows: fix normalization of UNC paths 2012-11-21 01:21:25 +01:00
Paul Serby
41e53e5579 path: add platform specific path delimiter
Closes #3728
Closes #4071
2012-10-01 22:10:36 +02:00
isaacs
985e3a25cb lint 2012-08-27 13:03:30 -07:00
Felix Böhm
d15bfc04cd path: small speed improvements 2012-08-10 12:55:49 +02:00
isaacs
5b39929d47 Add --no-deprecation and --trace-deprecation flags 2012-06-21 12:05:33 -07:00
isaacs
5164ae3838 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
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-15 11:37:34 -07:00
Bert Belder
d91004a73d Windows: make path.normalize convert all slashes to backslashes
Closes #3066
2012-05-13 03:18:09 +02:00
Yi, EungJun
4bd54dad33 path: add path.sep to get the path separator. 2012-05-01 15:19:37 +02:00
isaacs
0cdf85e28d Lint all the JavaScripts. 2012-02-18 15:34:57 -08:00
isaacs
31721da4b1 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
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-18 09:46:58 -08:00
Bert Belder
d91bc7cb09 Windows: get rid of process._cwdForDrive() 2012-02-16 00:10:51 +01:00
isaacs
116835561d Merge remote-tracking branch 'ry/v0.6'
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-06 15:43:21 -08:00
Bert Belder
e5ea6ad0f0 _makeLong shouldn't turn the empty string into \\?\C:\ 2012-02-02 17:14:03 +01:00
Bert Belder
a661830569 Run path.exists paths through _makeLong 2012-02-02 17:14:01 +01:00
Brandon Benvie
5403a8ce4c core: add NativeModule.prototype.deprecate
Formalize and cleanup handling of deprecated core methods.
2012-01-30 00:27:07 +01:00
Fedor Indutny
667aae596c Merge branch 'v0.6'
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-24 00:30:28 +06:00
Maciej Małecki
e10ed097cb path fs: move path.exists* to fs.exists*
`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-21 14:37:14 +01:00
Bert Belder
d489a01f81 Make path.extname do the right thing when the last path component is . or ..
Closes GH-2526
2012-01-18 15:21:58 +01:00
Bert Belder
f4e34f1b76 Remove unnecessary statement 2011-12-20 17:15:22 +00:00
Author: Igor Zinkovsky
1f16a7b6e5 Enable long paths on windows 2011-11-25 09:35:52 +01:00
Bert Belder
86fba381fd Windows: correctly resolve drive-relative paths 2011-11-24 02:38:34 +01:00
Colton Baker
87286cc737 Fixed a lot of jslint errors.
Fixes #1831
2011-10-05 18:51:06 -07:00
Bert Belder
8153a21613 Improve path parsing on windows
Closes #650
2011-09-06 04:47:36 +02:00
Thomas Shinnick
a5d90c435c path.js: correct three harmless .length typos
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...)
2011-08-14 04:10:42 +02:00
Robert Mustacchi
de0b8d601c jslint cleanup: path.js, readline.js, repl.js, tls.js, tty_win32.js, url.js 2011-07-29 11:58:02 -07:00
Adam Luikart
7f30f13543 Update POSIX splitPathRe to allow control chars. Fixes #1230.
Use [\s\S] instead of . to match any char, including newlines.
2011-07-04 22:50:27 +02:00
Ryan Dahl
247d880113 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-14 17:45:15 -07:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Tony Huang
502900c0bc add path.relative 2011-03-08 11:03:21 -08:00
Bert Belder
38d8cd60ea Don't make unnecessary getcwd calls from path.resolve 2011-02-08 14:30:24 -08:00
Ryan Dahl
5a05992155 Lint 2011-01-06 16:06:27 -08:00
Bert Belder
7c731ec9dd Path.resolve, path module windows compatibility
Removes path.normalizeArray() and path.split()
2011-01-06 15:36:25 -08:00
Bert Belder
9ddfcfecca Remove keepBlanks flag from path functions 2011-01-05 11:17:38 -08:00
Bert Belder
9be07f7fe1 _Partial_ fix for backslash path separator support in path.js
Needs review & tests
2010-12-20 23:51:27 +01:00