diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-09-17 14:01:58 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-09-17 14:01:58 (GMT) |
| commit | aec87aa3e11fed49c9f25ec6b38a63c1d2bf62d5 (patch) | |
| tree | b02b463e908aa319df467048c516a157117614bf /generic/tclFCmd.c | |
| parent | 0e0e0f9ad3e5af2190b160407f271d8fc0ae5ad0 (diff) | |
| parent | d171543388eb0149647f980eb25c80a9bfdadd1e (diff) | |
| download | tcl-aec87aa3e11fed49c9f25ec6b38a63c1d2bf62d5.zip tcl-aec87aa3e11fed49c9f25ec6b38a63c1d2bf62d5.tar.gz tcl-aec87aa3e11fed49c9f25ec6b38a63c1d2bf62d5.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'generic/tclFCmd.c')
| -rw-r--r-- | generic/tclFCmd.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 6eb6644..2d24207 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -1650,6 +1650,82 @@ TclFileTempDirCmd( } /* + *---------------------------------------------------------------------- + * + * TclFileHomeCmd -- + * + * This function is invoked to process the "file home" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclFileHomeCmd( + TCL_UNUSED(void *), + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + Tcl_Obj *homeDirObj; + + if (objc != 1 && objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?user?"); + return TCL_ERROR; + } + homeDirObj = TclGetHomeDirObj(interp, objc == 1 ? NULL : Tcl_GetString(objv[1])); + if (homeDirObj == NULL) { + return TCL_ERROR; + } + Tcl_SetObjResult(interp, homeDirObj); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * 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 |
