Skip to content

Commit 4c8800c

Browse files
yorkiervagg
authored andcommitted
fs,doc: use target instead of destination
PR-URL: #3912 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bert Belder <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 634c5f1 commit 4c8800c

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

doc/api/fs.markdown

+9-3
Original file line numberDiff line numberDiff line change
@@ -664,16 +664,22 @@ information.
664664

665665
Synchronous stat(2). Returns an instance of [`fs.Stats`][].
666666

667-
## fs.symlink(destination, path[, type], callback)
667+
## fs.symlink(target, path[, type], callback)
668668

669669
Asynchronous symlink(2). No arguments other than a possible exception are given
670670
to the completion callback.
671671
The `type` argument can be set to `'dir'`, `'file'`, or `'junction'` (default
672672
is `'file'`) and is only available on Windows (ignored on other platforms).
673673
Note that Windows junction points require the destination path to be absolute. When using
674-
`'junction'`, the `destination` argument will automatically be normalized to absolute path.
674+
`'junction'`, the `target` argument will automatically be normalized to absolute path.
675675

676-
## fs.symlinkSync(destination, path[, type])
676+
Here is an example below:
677+
678+
fs.symlink('./foo', './new-port');
679+
680+
It would create a symlic link named with "new-port" that points to "foo".
681+
682+
## fs.symlinkSync(target, path[, type])
677683

678684
Synchronous symlink(2). Returns `undefined`.
679685

lib/fs.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -920,29 +920,29 @@ function preprocessSymlinkDestination(path, type, linkPath) {
920920
}
921921
}
922922

923-
fs.symlink = function(destination, path, type_, callback_) {
923+
fs.symlink = function(target, path, type_, callback_) {
924924
var type = (typeof type_ === 'string' ? type_ : null);
925925
var callback = makeCallback(arguments[arguments.length - 1]);
926926

927-
if (!nullCheck(destination, callback)) return;
927+
if (!nullCheck(target, callback)) return;
928928
if (!nullCheck(path, callback)) return;
929929

930930
var req = new FSReqWrap();
931931
req.oncomplete = callback;
932932

933-
binding.symlink(preprocessSymlinkDestination(destination, type, path),
933+
binding.symlink(preprocessSymlinkDestination(target, type, path),
934934
pathModule._makeLong(path),
935935
type,
936936
req);
937937
};
938938

939-
fs.symlinkSync = function(destination, path, type) {
939+
fs.symlinkSync = function(target, path, type) {
940940
type = (typeof type === 'string' ? type : null);
941941

942-
nullCheck(destination);
942+
nullCheck(target);
943943
nullCheck(path);
944944

945-
return binding.symlink(preprocessSymlinkDestination(destination, type, path),
945+
return binding.symlink(preprocessSymlinkDestination(target, type, path),
946946
pathModule._makeLong(path),
947947
type);
948948
};

src/node_file.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
580580

581581
int len = args.Length();
582582
if (len < 1)
583-
return TYPE_ERROR("dest path required");
583+
return TYPE_ERROR("target path required");
584584
if (len < 2)
585585
return TYPE_ERROR("src path required");
586586
if (!args[0]->IsString())
587-
return TYPE_ERROR("dest path must be a string");
587+
return TYPE_ERROR("target path must be a string");
588588
if (!args[1]->IsString())
589589
return TYPE_ERROR("src path must be a string");
590590

591-
node::Utf8Value dest(env->isolate(), args[0]);
591+
node::Utf8Value target(env->isolate(), args[0]);
592592
node::Utf8Value path(env->isolate(), args[1]);
593593
int flags = 0;
594594

@@ -604,9 +604,9 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
604604
}
605605

606606
if (args[3]->IsObject()) {
607-
ASYNC_DEST_CALL(symlink, args[3], *path, *dest, *path, flags)
607+
ASYNC_DEST_CALL(symlink, args[3], *path, *target, *path, flags)
608608
} else {
609-
SYNC_DEST_CALL(symlink, *dest, *path, *dest, *path, flags)
609+
SYNC_DEST_CALL(symlink, *target, *path, *target, *path, flags)
610610
}
611611
}
612612

0 commit comments

Comments
 (0)