diff options
author | hobbs <hobbs> | 1999-10-05 22:46:13 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 1999-10-05 22:46:13 (GMT) |
commit | f15864c82ed41e0776fb9e0d200f7423b91ecf70 (patch) | |
tree | 407387c39a13993782cd030aed2c747329080649 /mac/tclMacFCmd.c | |
parent | 25e723296d7e7b8473d6f19523593ac24f07a3dd (diff) | |
download | tcl-f15864c82ed41e0776fb9e0d200f7423b91ecf70.zip tcl-f15864c82ed41e0776fb9e0d200f7423b91ecf70.tar.gz tcl-f15864c82ed41e0776fb9e0d200f7423b91ecf70.tar.bz2 |
* mac/tclMacFCmd.c: fixed filename stuff to support UTF-8 [Bug: 2869]
Diffstat (limited to 'mac/tclMacFCmd.c')
-rw-r--r-- | mac/tclMacFCmd.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/mac/tclMacFCmd.c b/mac/tclMacFCmd.c index dbd0680..181130e 100644 --- a/mac/tclMacFCmd.c +++ b/mac/tclMacFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacFCmd.c,v 1.5 1999/05/11 07:12:00 jingham Exp $ + * RCS: @(#) $Id: tclMacFCmd.c,v 1.6 1999/10/05 22:46:14 hobbs Exp $ */ #include "tclInt.h" @@ -1194,15 +1194,19 @@ static int GetFileFinderAttributes( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute option. */ - CONST char *fileName, /* The name of the file. */ + CONST char *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { OSErr err; FSSpec fileSpec; FInfo finfo; - - err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec); - + Tcl_DString pathString; + + Tcl_UtfToExternalDString(NULL, path, -1, &pathString); + err = FSpLocationFromPath(Tcl_DStringLength(&pathString), + Tcl_DStringValue(&pathString), &fileSpec); + Tcl_DStringFree(&pathString); + if (err == noErr) { err = FSpGetFInfo(&fileSpec, &finfo); } @@ -1269,14 +1273,18 @@ static int GetFileReadOnly( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file. */ + CONST char *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **readOnlyPtrPtr) /* A pointer to return the object with. */ { OSErr err; FSSpec fileSpec; CInfoPBRec paramBlock; - - err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec); + Tcl_DString pathString; + + Tcl_UtfToExternalDString(NULL, path, -1, &pathString); + err = FSpLocationFromPath(Tcl_DStringLength(&pathString), + Tcl_DStringValue(&pathString), &fileSpec); + Tcl_DStringFree(&pathString); if (err == noErr) { if (err == noErr) { @@ -1330,14 +1338,18 @@ static int SetFileFinderAttributes( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file. */ + CONST char *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* The command line object. */ { OSErr err; FSSpec fileSpec; FInfo finfo; - - err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec); + Tcl_DString pathString; + + Tcl_UtfToExternalDString(NULL, path, -1, &pathString); + err = FSpLocationFromPath(Tcl_DStringLength(&pathString), + Tcl_DStringValue(&pathString), &fileSpec); + Tcl_DStringFree(&pathString); if (err == noErr) { err = FSpGetFInfo(&fileSpec, &finfo); @@ -1418,15 +1430,19 @@ static int SetFileReadOnly( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file. */ + CONST char *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *readOnlyPtr) /* The command line object. */ { OSErr err; FSSpec fileSpec; HParamBlockRec paramBlock; int hidden; - - err = FSpLocationFromPath(strlen(fileName), fileName, &fileSpec); + Tcl_DString pathString; + + Tcl_UtfToExternalDString(NULL, path, -1, &pathString); + err = FSpLocationFromPath(Tcl_DStringLength(&pathString), + Tcl_DStringValue(&pathString), &fileSpec); + Tcl_DStringFree(&pathString); if (err == noErr) { if (Tcl_GetBooleanFromObj(interp, readOnlyPtr, &hidden) != TCL_OK) { |