diff options
| author | griffin <briang42@easystreet.net> | 2022-09-16 14:14:35 (GMT) |
|---|---|---|
| committer | griffin <briang42@easystreet.net> | 2022-09-16 14:14:35 (GMT) |
| commit | 5dcbe3cfeb67425d52a4dcec68ace19e409d5105 (patch) | |
| tree | 71a75ce67802b8fdb7dcf04b4b11a3dc4de7f651 /generic/tclFCmd.c | |
| parent | 3be920cf8fde24640c4527c8f59024e22eee9930 (diff) | |
| parent | d171543388eb0149647f980eb25c80a9bfdadd1e (diff) | |
| download | tcl-5dcbe3cfeb67425d52a4dcec68ace19e409d5105.zip tcl-5dcbe3cfeb67425d52a4dcec68ace19e409d5105.tar.gz tcl-5dcbe3cfeb67425d52a4dcec68ace19e409d5105.tar.bz2 | |
Sync with core-8-branch
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 |
