summaryrefslogtreecommitdiffstats
path: root/generic/tclFCmd.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2022-08-19 16:52:07 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2022-08-19 16:52:07 (GMT)
commite52c7c3a41a6fb4a3deeade3447de39ee569f0fd (patch)
treea663853f6c59c39da276963ebfabf7c205a93a16 /generic/tclFCmd.c
parentff9ac0bfbdf42dea8bdffaaabc02977bba867a55 (diff)
downloadtcl-e52c7c3a41a6fb4a3deeade3447de39ee569f0fd.zip
tcl-e52c7c3a41a6fb4a3deeade3447de39ee569f0fd.tar.gz
tcl-e52c7c3a41a6fb4a3deeade3447de39ee569f0fd.tar.bz2
Implement file tildeexpand
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r--generic/tclFCmd.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index d7fa750..6bf34d8 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -1680,6 +1680,44 @@ TclFileHomeCmd(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TclFileTildeExpandCmd --
+ *
+ * This function is invoked to process the "file tildeexpand" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclFileTildeExpandCmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ Tcl_Obj *expandedPathObj;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "path");
+ return TCL_ERROR;
+ }
+ expandedPathObj = TclResolveTildePath(interp, objv[1]);
+ if (expandedPathObj == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, expandedPathObj);
+ return TCL_OK;
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4